Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Calculation based on different colums

ecemurun
7 - Meteor

Hello,

 

I would appreciate your help for the below.

 

I am trying to do the calculation of  (A+E-I) in column Group_2 based on Group_1 and Date columns. The output should give me the result of (A+E-I) for each date in Date column based on Group_1  e.g. for the date 01/2018 for 1 (in Group_2).

 

I Would appreciate if you can show me a way. Thanks a lot from now!

 

Group_1DateGroup_2Group_3
1 01/2018 A88499199
1 02/2017 E20495841
1 02/2018 I73523158
2 03/2016 A3925154
2 03/2017 A134788779
2 03/2018 E56657015
3 04/2016 I13015090
3 04/2017 A24346367
3 04/2018 A93157900
4 05/2016 A22610337
4 05/2016 E296460
4 05/2016 I384300
5 05/2017 A4635626
5 06/2016 A32237117
5 06/2016 I164700
6 06/2017 A6638057
6 07/2016 A29719962
6 07/2016 E164700
6 07/2016 I182350
6 07/2017 A8344392
3 REPLIES 3
BenMoss
ACE Emeritus
ACE Emeritus

I would suggest you cros-tab your data.

 

Group by your 'Group_1' field and your 'Date' field.

 

Your header field will be 'Group_2' and then your value field will be 'Group_3' and choose the aggregation 'sum'.

 

Then you can use a formula tool to perform your A+E-I.

 

Alternatively you could do a formula tool which converts the 'Group_3' value to be negative when 'Group_2' = I.

 

Then you could use a summerize tool, grouping by your 'Group_1' and 'Date' fields and then SUM the ammended 'Group_3' field.

 

Ben

BenMoss
ACE Emeritus
ACE Emeritus

Okay, it seems like the value in 'Group_2' is derived from the date field. So I would remove this from all the 'group bys' I mentioned, either in the cross-tab or summerize tool, depending on which method you use.

 

Solution attached. Let me know if this meets the requirements.

 

Ben

ecemurun
7 - Meteor

Hi Ben,

Thank you for your super fast answer. It worked.

Labels