Alteryx Designer Desktop Discussions

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

Finding the largest number among a group (similar to For Loop)

ADhal
5 - Atom

I have a data set like below:

 

CountrySumRevenueSumDiscountM1M2CountryRevenueDiscount(5%ofRevenue)
Australia100050JonMacAustralia1005
Australia100050JonMacAustralia1507.5
Australia100050JonMacAustralia20010
Australia100050MacMacAustralia25012.5
Australia100050TomMacAustralia30015
India36018RaviRajIndia1206
India36018RaviRajIndia1306.5
India36018RajRajIndia1105.5
US127063.5BobLizUS30015
US127063.5JimLizUS40020
US127063.5MaryLizUS34017
US127063.5LizLizUS23011.5

 

I want to iterate for each country, and compare between M1 and M2. If M1 = M2 and Revenue = MAX(Revenue), then select that line, else select the line with MAX(Revenue)

 

So expected Output is:

 

CountrySumRevenueSumDiscountM1M2CountryRevenueDiscount(5%ofRevenue)
Australia100050MacMacAustralia25012.5
India36018RaviRajIndia1306.5
US127063.5JimLizUS40020

 

For Australia, M1 = M2 but for India and US, the line with MAX(Revenue) is selected. 

 

Any help will be greatly appreciated. 

1 REPLY 1
princejindal
9 - Comet

Hi @ADhal,

 

Find attached the solution.

 

Cheers!

Labels