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

Sum across row level

shikhar6339
7 - Meteor

Hi All,

 

I have below records and I need an additional column which tells me the sum across row level. Request your help in resolution.

 

Data:

A121414512664
B216765133643
C3211235479963
D53234856541352
E1233474854957

58

 

 

Output required:

 

A121414512664235
B216765133643812
C3211235479963676
D532348565413521091
E1233474854957582100
6 REPLIES 6
jrgo
14 - Magnetar

Here's a couple options to do this. The 3rd option, not included, is of course to to just use a Formula to add up each field which may be OK if you always have the same amount of fields to add up.

 

Note that in the Cross Tab tool (first option), there's 2 "Method for Aggregating Values" options selected.

michelle_mathews
Alteryx Alumni (Retired)

Hi @shikhar6339 , two ways this might be accomplished. Example attached!

 

 

Screenshot 2023-09-05 130922.png

adamweaver39
9 - Comet

I think this would be easiest to resolve with a simple Formula tool where you add up each Column!

Otherwise, you could use the Cross Tab and Summarize tool.

caltang
17 - Castor
17 - Castor

I would go with Transpose tool then Cross-Tab tool to ensure that it is dynamic. Because it accounts for future fields/columns that you may need, and it is flexible enough to ignore dropped fields if it changes (change the Transpose tool setting at the bottom of its configuration pane on the left). 

 

That way you get your horizontal sums dynamically all the time. Refer to @michelle_mathews ' second solution in their attached workflow.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Qiu
21 - Polaris
21 - Polaris

@shikhar6339 
I also agree with @caltang  @michelle_mathews approach, which is dynamic.
We do need to ntoe that there is a drawback is the name of columns might change after Cross Tab by adding some underscore.
We can use Dynamic Rename tool to bring them back.

shikhar6339
7 - Meteor

Thank you all. I tried using summation of columns via formula but wasn't getting the desired results. It was because some of records had null values. I replaced nulls with 0 and then summation worked.

Labels