Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Sum fields if multiple criteria are met

hellyars
13 - Pulsar

Reference the sample dataset below.  Basically I need to sum A-B or A-(B+E) for all ITEMS that have either a B, E, or B and E cost type. 

 

IF ITEM is the same, and cost type B is present (but not E), subtract the sum of B from A

IF ITEM is the same, and both cost B and E are present, subtract the sum of B+E from A.

 

I know that I can use a Multi Row to subtract B from A if B exists.  I assume I can do the same for B and E and then subtract from A. But, I am hoping there is simpler way of doing it. 

 

 

ITEMCOST TYPEValue
TrucksA341
PlanesA2355
PlanesC3252
BoatsA

13525

BoatsB

-1345

BoatsE

-1344

Boats L

3425

RocketsA

2355

RocketsB

-1345

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor

Hi @hellyars 

 

Does that suit you? It's a different approach, I don't know if it's good for you.

hellyars.PNG

 

 

Cheers,

Thableaus
17 - Castor
17 - Castor

@hellyars 

 

If you'd like to keep it in rows, you could tranpose it back, using transpose tool.

 

Cheers,

hellyars
13 - Pulsar

Looks interesting.  I am going to test it with the real data, which is a bit messier (with multiple value years).  I will get back to you.

hellyars
13 - Pulsar

It works - but a lot of flipping.  Get's a little busy when you are dealing with multiple value years (e.g., call value 2016, the add similar columns for 2017 and 2018).  

 

Thanks

 

Thableaus
17 - Castor
17 - Castor

@hellyars 

 

No problem. It's just a quick idea, but of course depending on data structure and size, some changes and adaptions are needed.

No model is perfect all the time.


Cheers,

Labels