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

Alteryx Designer Desktop Discussions

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

Dynamic Calculations

CrayonZac
7 - Meteor

Hi experts,

 

I have a question about Dynamitic Calculations. Please have a look at the following tables.

 

recordsDec-17Dec-18diff
1100200100
2300410110
3124988864
    
    
recordsDec-18Dec-19diff
1200400200
2410800390
3988100012

 

The first table is the current one, and the next year, the field names are different. I have Dateformat to change the Names, and I was wondering is there someway to calculate diff next year, by (column 3 - column 2), rather than Dec-19 - Dec-18

 

Thanks a lot

13 REPLIES 13
JohnJPS
15 - Aurora

Yet another approach, but which requires field-by-field selection: Dynamic Select with a Formula specifying FieldNumber:

scrnshot.png

CrayonZac
7 - Meteor

Thanks again. I noticed that Dynamic Select can select columns by Field Number, however, I would like to use Field Number to calculate Last 12 Month Value,. Output after Dynamic Select still keep the original Field Names, which will get changed periodically.

kmoreno
6 - Meteoroid

Thanks, this was super helpful!

 

I've been trying to find an alternative to using the transpose tool because it slows down my workflow and isn't the most practical for large volume.

 

Do you have any examples of recreating the crosstab functionality in the R Tool?

JohnJPS
15 - Aurora

HI @kmoreno,

 

In the R tool, it's as simple as:

df1 <- read.Alteryx("#1", mode="data.frame")
df2 = as.data.frame(t(df1))
write.Alteryx(df1, 1)
write.Alteryx(df2, 2)

This reads the input into df1, generates df2 as the transpose of df1, and then sends df1 to output1 and df2 to output2.

This is a full transpose, so a bit less functionality that the CrossTab tool.

 

Hope that helps!

John

Labels
Top Solution Authors