Free Trial

Alteryx Designer Desktop Discussions

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

Select single row based on multiple field conditions

ANARK
7 - Meteor

Hi Everyone - Im working on a report which has 500k lines of excel data. Looking for a way to extract only one line per ID based on some conditions.

 

In the sample below, I have to select one line per ID. Complete data is grouped by ID field. Under an ID - first check is on field "Level".

if its "High" it has to be selected, if we have multiple lines with the same level - line item with higher sum needs to be selected but based on Level.

 

Scenario:1 - if we have multiple\different levels for the same ID, Level "High" with higher sum needs to be selected.

Scenario:2 - if there is only one level, any of "High\Mid\Low" the line item with higher sum needs to be selected.

Scenario:3 - If we have only "Mid" & "Low", line item "Mid" with higher sum needs to be selected.

 

ScenarioIDFormBULevelProdCtrySum
110OAPJHighASG5
110RAPJLowDNZ10
110RAPJHighDNZ8
212REMEAMidBUK55
212PEMEAMidCUK120
315OAMERLowDUS35
315OAMERMidBCA15
425PAMERLowDUS35
425OAMERLowBCA15

 

The final output should look like below:

 

ScenarioIDFormBULevelProdCtrySum
110RAPJHighDNZ8
212PEMEAMidCUK120
315OAMERMidBCA15
425PAMERLowDUS35

 

Tried different things but couldnt get a solution, Any help will be much appreciated.

4 REPLIES 4
binuacs
21 - Polaris

@ANARK one way of doing this

image.png

Qiu
21 - Polaris
21 - Polaris

@ANARK 
I would see this as a basic sorting problem.

The level with "words" can not be sorted as we want, so we can convert them to integer then sort.

1125-ANARK.png

ANARK
7 - Meteor

Thanks, Let me try to implement and share update.

ANARK
7 - Meteor

Thanks for this, worked like I expected.

Labels
Top Solution Authors