Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to create an offset column

Silvex
6 - Meteoroid

Hello,

 

For an N group of ID´s I need to test the expected behavior. I managed to do this in Excel using, in the Expected ID column, the Offset formula that is =OFFSET(B2,C2,0).

 

Group Given ID Offset Expected ID Result
Group 1 A 0 A OK
Group 1 A -1 A OK
Group 1 B 0 B OK
Group 1 A -3 A OK

 

I tried to do this using the multi-row formula however I have to enter a specific number or rows which in my case is dynamic. I´ve attached an Excel spread sheet with an example. The column I need to create is the Expected ID column.

 

Any help will be appreciated.

 

Thanks!

10 REPLIES 10
MarqueeCrew
20 - Arcturus
20 - Arcturus
could you assign a record id to each row then for the offset calculate the row that you are looking for? Then you'll u could join in the record id and the calculated row. Upon a join you will have the given Id.
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
MarqueeCrew
20 - Arcturus
20 - Arcturus
Calc row := RecordID + offset.
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
jdunkerley79
ACE Emeritus
ACE Emeritus

Agree with @MarqueeCrew suggestion.

 

Just a couple of extra steps I think, you need to use a summarise tool to get the first record id for a Group and Given ID. After that you can join back to the original data to create the offset. Something like:

2016-04-19_09-40-11.jpg

 

SImple example attached.

Silvex
6 - Meteoroid

Thank you both  @MarqueeCrew and @

 

 

GroupGiven IDOffsetExpected IDResult
Group 3E0EOK
Group 3F0FOK
Group 3F-2EFAIL
jdunkerley79
ACE Emeritus
ACE Emeritus

Just to clarify the rules for the calculated values.

 

Should the offset be back to the first instance of Group, GivenID? i.e. in the case below would expect -1 for the last case.

 

You can use a formula tool to create both the Expected ID and Result, but need more details of the calculations before can give you guidance.

 

 

Silvex
6 - Meteoroid

I have an unknown amount of groups, a given ID that will be provided and an offset that I will be entering as well. I guess my question will be how to get the value of Expected ID based on the offset and the given ID?

 

Maybe the below image of what I did in Excel will help. I want to get column D.

 

I think I did not explain myself very well. Sorry about that. But this might help-

 

Sample.jpg

jdunkerley79
ACE Emeritus
ACE Emeritus

Makes perfect sense.

 

Ok so easiest is to add a RowCount and then we can use a formula tool to create the target RowCount to join to.

Having done that the Expected is an output of the joi n

And finally the result can be made from a formula tool.

 

Attached a sample

Silvex
6 - Meteoroid

Almost worked but the rows are off as you can see in the image below. The image on the right is Excel and the one from the left is Alteryx. The results are not quite the same. I try to fix it but not sure how.

 

Thank you

 

Sample1.jpg

jdunkerley79
ACE Emeritus
ACE Emeritus

I had the join the wrong way round (hence all offsets becoming 0) and hadnt reset the order back to the input order.

 

So fliped the Join so Joins Target to Record (rather than Record to Target)

And added a sort by Record ID to reorder back into original order.

 

2016-04-19_21-05-16.jpg

 

Updated workflow with some comments this time attached

Labels