community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Summarize with condition

Asteroid

Hello,

 

I need a help to summarize field with condition. I have field named TYPSRV and I wrote this formula.

 

IF [TYPSRV]=="P" THEN TOSTRING("E") ELSEIF
 [TYPSRV]=="L" THEN TOSTRING("E") ELSE
TOSTRING([TYPSRV]) ENDIF

 

I want a formula to look like this:

IF [TYPSRV]== "P" SUM "P" THEN TOSTRING("E") ELSEIF
 [TYPSRV]=="L" SUM "L" THEN TOSTRING("E") ELSE
TOSTRING([TYPSRV]) ENDIF

 

I want to create two fields with sum of P& L [TYPSRV_SUM OF "P"] AND [TYPSRV_SUM OF "L"]  

 

How can I archive that?

 

Thanks

 

Fireball

Hi @EvansM,

 

When you say you want to SUM, do you mean you have an actual numeric field in your data or do you want to count the number of "P"s?

 

Either way you can accomplish this with a summary tool. First group by the new formula you made there, and if you want to sum on a numeric field then do that after the group by. If you want a count of each "P" and "L" then add a count of your formula.

 

Capture.PNG

 

Best,

mmenth

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@EvansM ,

 

I have a slightly different suggestion than @EvansM .  Once you've created the new P/L variable, you could SUMMARIZE and Group by the P/L variable and then SUM the other amount field.  This gives you the sum of P/L.

 

Cheers,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Asteroid

Thanks @mmenth  for quick respond. What I want is if two rows of the data has "P" in it add them together and give the sum of it. And if two rows data has "L'' in it add them together and give me the sum of it.

 

Thanks

Meteoroid

Hi

 

this could possibly be achieved with two seperate filters and two seperate summarizesand a union, if all columns are the same.

 

could you upload an example of your workflow?

 

 

 

 

Asteroid

MBRHISTR1.png

Here is the data sample. I hope is going to help.

Asteroid
 
Asteroid

@hamster001  and @mmenth  Attached are the data set sample and expected results. Please take a look and see if it does make sense

Alteryx
Alteryx

Hi @EvansM 

I think this should achieve what you are looking for:

 

Workflow.png

 

I split the data out by type and then summed using the type as a group by

Asteroid

Thanks Joe,

But I am still missing [Tax] column in the expected results.

Labels