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.
SOLVED

SumIf Subtraction of Row Items

BrianDeg
5 - Atom

Hello! I have the following data with six rows and a header and I am trying to within Alteryx turn it into the second data table with 9 rows + a header. I would like a solution to the following that could work with six rows or six million rows. 

For each Year, I want to subtract the Value in Second from the Value in First. 

For example, for 2015, FIrst has a value of 10 and Second has a value of 5. I want to subtract 5 from 10  (i.e. 10-5 = 5) and put that in a new row with a Year as 2015, Name as Third, and Value as 5. 

Input Data:

YearNameValue
2015First10
2016First20
2017First30
2015Second5
2016Second5
2017Second5

 



Desired Output:

YearNameValue
2015First10
2016First20
2017First30
2015Second5
2016Second5
2017Second5
2015Third5
2016Third15
2017Third25


Please let me know if you have further questions, and thanks in advance for your help!

1 REPLY 1
Hugo
9 - Comet

Hi Andy,

 

Take a look at the attached - it should work regardless of the number of years, but not necessarily if there are more than 2 values you need to subtract, though you could modify it to suit your needs.

 

Regards,

 

Hugo

Labels