Alteryx Designer Desktop Discussions

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

Filter data by max count

Suvasini
7 - Meteor

Hi all,

Requesting some help for a workflow im stuck In.

My data looks  like this:

TrainNoDistanceOriginCodeCount
159054273Awy1
159054273Cape28
159054273Ndls5
159064273Apdj5
159064273Asn2
159064273Dbrg28
159054231Awy1
159054231Bza1
159054231Cape23

Each train runs through multiple origin stations but I want to capture the highest distance each train runs through. So for train 15905, it covers distance of 4273 and 4231 but I only require the highest one. There are various origin codes coming for 4273 like Awy, cape and ndls, but I want to capture the origin station with the highest count so Cape in this this. Main idea being, for each train which has various distances, I want to capture the highest distance and a station with the highest count within the max distance.

 

My output needs to look like this. Each train should only have one row data. Would appreciate any help, thanks

 

TrainNoDistanceOriginCodeCount
159054273Cape28
159064273Dbrg28
5 REPLIES 5
BenMoss
ACE Emeritus
ACE Emeritus

Hi @Suvasini the tool that will allow you to attack this problem is the Summerize tool, which will allow you to aggregate your data for each 'TrainNo'.

 

The configuration:

 

GroupBy: TrainNo

Max: Distance

Max: Count 

 

Will return you your two row table given your sample, the only value missing would be your OriginCode which matches the max count, this can be bought through by joining your summerize output with your original data, joining on 'TrainNo', 'Distance=MaxDistance' and 'Count='MaxCount'.

 

Hope this is useful

Ben

Qiu
21 - Polaris
21 - Polaris

@Suvasini 
I think Sort Tool is a very good fit for this situation.

0310-Suvasini.PNG

Suvasini
7 - Meteor

Thankyou!

BenMoss
ACE Emeritus
ACE Emeritus

@Qiu Much better!

Kaashvi16
5 - Atom

Which tool is beneficial to compute the distance of top 3 closest stations from lets assume station A?

Labels