Free Trial

Alteryx Designer Desktop Discussions

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

Relative Difference between columns

KK123
6 - Meteoroid

Hi Folks

 

I have below requirement to find the difference between the last 3 columns where the data is found . tried to explain the below table. Can someone help with the workflow pls

 

 Date              Difference in DaysDifference in DaysDifference in Days
 1-Jan-212-Jan-213-Jan-214-Jan-215-Jan-216-Jan-217-Jan-218-Jan-219-Jan-2110-Jan-2111-Jan-2112-Jan-2113-Jan-2114-Jan-2115-Jan-21Recent 1( Out put Required)Prior 1 to Recent 1( Out put Required)

Prior 2 to Recent 1

( Out put Required)

A1  1  1  1  1 115Jan - 13 Jan13Jan-7Jan7Jan- 4 Jan
B 1  1  1  1 1  13Jan-11Jan11Jan-8Jan8Jan-5Jan
C   1 1 1  11 1 14Jan-12-Jan12Jan-11Jan11Jan-8Jan
D  1   1 1   1 115Jan - 13 Jan13Jan-9Jan9Jan-7Jan
5 REPLIES 5
BenMoss
ACE Emeritus
ACE Emeritus

Hi @KK123 the solution lies within the structure of your data, with this kind of problem it's always best to pivot your data so that you can reference values within a single field, which allows you to build a much more dynamic process.

 

I am struggling to understand the concepts of the solutions you want however.

The first calculation is simple to achieve, but I don't understand how column 2 works, there doesn't seem to be consistency.

 

In row A 'Prior 1 to Recent 1' to me should be '13Jan-10Jan' not what you have shown? Is this an error in my understanding or the example data you have used?

 

Ben

 

 

 

BenMoss
ACE Emeritus
ACE Emeritus

Based on the assumption that you have just made some mistake when sharing the data for record A, here's an example solution for you.

 

You'll see we can pivot our data and then assign a rank within each group, we can then use this rank to filter the different 'lookbacks' that we want.

 

Ben

afv2688
16 - Nebula
16 - Nebula

Hello @KK123 ,

 

I came up with this solution:

Untitled.png

 

 

Regards

KK123
6 - Meteoroid

Thanks a lot .  I need the difference in days . Can u help with that 

 

pedrodrfaria
13 - Pulsar

@KK123 To complement @afv2688's answer, I believe that you just need to change the Multi Row being performed right here to do a datetime diff function. The rest should be the same.

 

pedrodrfaria_0-1616676420395.png

 

Labels
Top Solution Authors