alteryx Community

# Alteryx Designer Desktop Discussions

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

## Sumif multiple columns

7 - Meteor

Hi masters,

I would like to create a total column base on the following "IF" logic:

IF Type='E' THEN sum(A1:A6) ELSE sum(B1:B6) ENDIF

 Account Org Type A1 A2 A3 A4 A5 A6 B1 B2 B3 B4 B5 B6 003325 011 E 13 - 18 22 45 3 11 16 - 29 16 21 220910 018 B 2 32 24 - 17 26 33 45 22 07 - 18 220910 011 B 3 12 11 16 - 29 21 13 29 16 21 13 001318 013 E 29 16 21 13 29 16 13 29 16 21 13 29 001318 018 B 17 26 8 33 45 22 3 12 11 16 - 45 003325 011 E 45 3 16 21 13 29 - 29 16 16 - 29

The expected result should have a total column as following:

 Account Org Type Total 003325 011 E 101 220910 018 B 125 220910 011 B 113 001318 013 E 124 001318 018 B 87 003325 011 E 127

Thanks for your help

6 REPLIES 6
16 - Nebula

Here is one way of doing this.

Your first and last row of the expected output should be summed, right?

 Account Org Type Total 003325 011 E 101 220910 018 B 125 220910 011 B 113 001318 013 E 124 001318 018 B 87 003325 011 E 127

If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)

Thanks.

16 - Nebula

One way of doing this.

The first and last row of your example should be summarized, right?

 Account Org Type Total 003325 011 E 101 220910 018 B 125 220910 011 B 113 001318 013 E 124 001318 018 B 87 003325 011 E 127

If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)

Thanks.

16 - Nebula

One way of doing this:

11 - Bolide

this should work

my solution has one less row than your desired output because the Account, Org, and Type are identical. you need something unique to differentiate these rows if you want them separate

14 - Magnetar

Maybe you need this output:

Formula of [Value] :

``````IF [Type]="E" && left([Name], 1)="A" THEN [Value]
ELSEIF [Type]!="E" && left([Name], 1)!="A" THEN [Value]
ELSE 0 ENDIF``````

***********

If it can help you get want result, please mark it as a solution and give a like for more share.

19 - Altair

If the number of columns is constant over time, you can always just use a simple formula tool

if [Type] = "E" then
[A1]+[A2]+[A3]+[A4]+[A5]+[A6]
else
[B1]+[B2]+[B3]+[B4]+[B5]+[B6]
endif

Dan

Labels