Alteryx Designer Desktop Discussions

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

To find Max value from table based on group

alt_tush
9 - Comet

Hi, 

 

I have below set of data. i want to find out max value based on group level data.

 

DeptRevenue
HR10
HR30
HR20
IT100
IT200
IT500
IT300
ADMIN3000
ADMIN1000
ADMIN2000

 

I am expecting below output in Max column to get "Y" & "N" next to their revenue based on dept level.

 

DeptRevenueMax
HR10N
HR30Y
HR20N
IT100N
IT200N
IT500Y
IT300N
ADMIN3000Y
ADMIN1000N
ADMIN2000N

 

Thank you for the help. 

 

4 REPLIES 4
DataNath
17 - Castor
17 - Castor

@alt_tush here's how I'd go about this - basically just use a summarize to find the max for each group, before utilising a join to see whether or not each revenue matches the max for that department. We then just flag the two sets of results and union them back together to finish - the sort and select were extra tools used to maintain the original order and then clean the layout back up.

 

DataNath_0-1665654796641.png

alt_tush
9 - Comet

Hi DatNath,

 

Thank you for your prompt reply.

 

Is there any way to avoid the join on Revenue column and get the same output. Because i don't want to join on revenue column as it is not the key field.

 

Thank you again :)

DataNath
17 - Castor
17 - Castor

No problem @alt_tush. Whenever a request like this comes up, the usual approach is to do it this way as the join only pulls out the actual max and allows us to easily flag the 2 output streams. Part of the join is also [dept] so it'll only look for the max in each relevant department rather than across all revenues.

 

As a worst case scenario, if you're really against the join, you could perhaps just append the max's to all records and use a filter to remove those that don't match, before adding a formula to put the flag in. However, this will blow your data up and lead to a drop in performance, especially if your dataset is large.

binuacs
21 - Polaris

@alt_tush One way of doing this is by assigning a record id to each field and joining based on the record id field

 

binuacs_0-1665700264790.png

 

Labels
Top Solution Authors