Start Free Trial

Alteryx Designer Desktop Discussions

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

[HELP] Conditional Sum based on a column value

Arcane
7 - Meteor

Hello,

 

I am trying to perform a SUM operation for specific rows based on a column value. Below is the illustration.

 

Column1Column2Formula usedAlteryx Formula Used
ID110  
ID220  
ID330ID1 + ID2Row -1 + Row -2
ID440  
ID550  
ID660  
ID7150ID5 + ID6 + ID7Row-1+Row-2+Row-3
ID880  
ID990  
ID10190ID3 + ID7 
ID11110  
ID12120  
ID13530ID1 + ID2 + ID5 + ID7 + ID10 + ID11Row-12+Row11+Row-8+Row-6+Row-3+Row-2
ID14140  
ID15150  

 

Currently, I am using Multi-Row Formula tool. But, I don't find this an efficient way of doing a summation, as I have to count the rows and mention as Row-NUMBER.

 

Is there any way that, I can actually perform a SUM like, IF Column1=ID13 THEN SUM_(ID1 + ID2 + ID5 + ID7 + ID10 + ID11)

 

Looking for easy and better ways of performing this operation.

 

Thanks in advance :)

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@Arcane 
I know it has to be Dynamic Replace tool. but still make it work...😅

atcodedog05
22 - Nova
22 - Nova

Hi @Arcane 

 

Does this work for you.

 

atcodedog05_0-1646142680541.png

 

Hope this helps : )

 

Arcane
7 - Meteor

@atcodedog05, Thanks for your interest to provide help.

 

The objective is to get the SUM as shown in Column2. Your solution is giving a different output.

And the Formulas are static. There is no definite logic to perform SUM UP or SUM DOWN.

 

In the similiar fashion, I have around 150 rows. and 130th row is a sum of Row 50+65+69+83.

 

So, in that case, using ROW-50, Row-65 etc doesn't seem a right way ... Hence, looking for a better solution.

 

 

Arcane
7 - Meteor

@atcodedog05, Not really the solution I am looking for/ or trying to achieve.

 

In your example, the OUTPUT values doesn't match with Column2.

 

- Column2 is the final value I need to achieve.

- Currently, to acheive, I am using ROW-1, Row-2 etc method.

- But for the large dataset I have, somewhere in 150th record, it is the SUM of  Recods (1+45+48+49+76). In this case, I have to count the number of rows backwards to 1,45,48,49,76 and write it as Row-149+Row-145 + Row-102 etc.

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @Arcane 

 

Looking into it I will post if I find a solution.

Labels
Top Solution Authors