Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Dynamically calculate new columns

Alteryxexpert
8 - Asteroid

I have data like below, where for each time period the columns will get changed to different quarters, Q1'23 to Q2'23 & Q1'24 to Q2'24.

ABCDEFGH
CurrencyQ1'23Q1'24Q1'24 vs Q1'23Q1'24 vs Q1'23%Q1_23Q1_24Inflation
TND828751-77-9%1044100
INR961654-307-32%   
GBP17881405-383-21%1044100
JPY70488117725% 125 
SGP24922287-205-8%104129-25
EUR212149-63-30%   
CNY51671631%   
RUB3404016118%   
LKR603617142%   
SEK3441721%   
CHF441382-59-13%   
THB474423-51-11%   
USD35693328-241-7%104129-25

 

I want the output like below which needs to be calculated dynamically whenever the columns are getting changed, Columns I,J,K,L needs to be calculated dynamically based on the previous columns.

 

ABCDEFGHIJKL
CurrencyQ1'23Q1'24Q1'24 vs Q1'23Q1'24 vs Q1'23%Q1_23Q1_24InflationQ1'23Q1'24Q1'24 vs Q1'23Q1'24 vs Q1'23%
TND828751-77-9%1044100B3-F3C3-G3J3-I3Difference in % Between Column J & I
INR961654-307-32%   B4-F4C4-G4J4-I4Difference in % Between Column J & I
GBP17881405-383-21%1044100B5-F5C5-G5J5-I5Difference in % Between Column J & I
JPY70488117725% 125 B6-F6C6-G6J6-I6Difference in % Between Column J & I
SGP24922287-205-8%104129-25B7-F7C7-G7J7-I7Difference in % Between Column J & I
EUR212149-63-30%   B8-F8C8-G8J8-I8Difference in % Between Column J & I
CNY51671631%   B9-F9C9-G9J9-I9Difference in % Between Column J & I
RUB3404016118%   B10-F10C10-G10J10-I10Difference in % Between Column J & I
LKR603617142%   B11-F11C11-G11J11-I11Difference in % Between Column J & I
SEK3441721%   B12-F12C12-G12J12-I12Difference in % Between Column J & I
CHF441382-59-13%   B13-F13C13-G13J13-I13Difference in % Between Column J & I
THB474423-51-11%   B14-F14C14-G14J14-I14Difference in % Between Column J & I
USD35693328-241-7%104129-25B15-F15C15-G15

J15-I15

Difference in % Between Column J & I

 

How to achieve this in alteryx?

5 REPLIES 5
KGT
11 - Bolide

You can bring the data in with the selection in the input tool for "First row contains data". That will make the column names generic and you can refer to [Field3] or similar.

That will help you with this specific request, however I expect that you could automate more of this process that would make this part easier. Whether that be by transposing the data to reference generic columns, or constructing those variances in the same process. Maybe a separate line for each quarter.

Alteryxexpert
8 - Asteroid

The input data is the ouput of previous steps inside the alteryx workflow, this will be the last step of my alteryx workflow that i'm developing.

KGT
11 - Bolide

OK, if the data is already in, then you've got to make the field names generic so they can be referenced.

You can do this several ways.

 

An easy/quick way would be to use a field info tool, apply a recordID, use a formula to create the generic field names for row 2/3/6/7 and then a dynamic rename. This can also be done in reverse.

Mocked up below:

 

PictureThis_screenshot_20240918_170537.jpg

Alteryxexpert
8 - Asteroid

This is Not working  for my Case, Is there any alternate solution can we have if any?

KGT
11 - Bolide

There's several ways to do it, but if that above solution is not working then there's something else at play. And without the required reasons for why it's not working, I don't know what that is.

Labels