We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Filter for first N of rows until row value exceeds X % with different groupings

beelix
5 - Atom

Hoping someone could help me with this.

 

I have a table containing Profit for 3 different businesses (first 3 columnns). For each Business, I want to identify the key countries contributing to Business Profit.  As Profit can be a gain or loss, Countries contributing large losses should also be included.

 

So far, I created 4th to 6th columns:

  • 4th Column - Sub Total of Profit for each Business 
  • 5th Column  - Country Profit divide by Total Profit Per Business -e.g. $250K / $415K for first row.
  • 6th Column - Cumulative % of 5th column (grouping based on each Business)

The criteria to identify major driver is to include the rows up to the point cumulative % is greater than 90% but it also has to be less than 130% (e.g. for Business #4, if I simply use > 90%, i would only identify France but omit Belgium and UK which is not the objective).  Once I meet the criteria, I want to exclude all rows which are deemed to be minor contributors.

 

In the 7th column, I have manually identified the rows which I want Alteryx to be able to filter for. If someone could help, that would be appreciated.

 

Thanks

Beelix

 

 

BusinessCountryProfitTotal Profit Per BusinessCountry Profit to Total Profit Per Business (%)Cumulative Profit to sub-Total (Per Business) 
Business #1United Kingdom250,000415,00060%60%Include
Business #1Australia100,000415,00024%84%Include
Business #1France60,000415,00014%99%Include
Business #1China30,000415,0007%106% 
Business #1Belgium-25,000415,000-6%100% 
Business #2United Kingdom175,000215,50081%81%Include
Business #2Australia-70,000215,500-32%49%Include
Business #2United States63750215,50030%78%Include
Business #2China25,500215,50012%90%Include
Business #2Belgium21,250215,50010%100% 
Business #3Australia-60,00022,000-273%-273%Include
Business #3France58,00022,000264%-9%Include
Business #3Belgium36,00022,000164%155%Include
Business #3United Kingdom-14,00022,000-64%91%Include
Business #3China2,00022,0009%100% 
Business #4France100,00026,000385%385%Include
Business #4Belgium-95,00026,000-365%19%Include
Business #4United Kingdom20,00026,00077%96%Include
Business #4China1,00026,0004%100% 

 

 

5 REPLIES 5
aatalai
15 - Aurora

@beelix  I started by giving a record ID grouped by businesses, and converted the percentage figure into double format, then found out the first time the cumulative percentage went over 90% (by filtering for values greater than 90% and then grouping by business and taking the minim record ID) then joining that as the threshold and filtering that the original record IDs are lower than the threshold just calculated or the percentage is over 130, hope this helps, please let me know how you get on 

 

Screenshot 2025-07-18 102949.png

PangHC
13 - Pulsar

@beelix maybe using Total movement (where SUM ABS) instead of net profit?
it ease to do the analysis.

Where max is 100%, it ease to find the main player. or filter by it own percentage.

for example, 
Screenshot 2025-07-18 182954.png

Pilsner
13 - Pulsar

Hello @beelix 

I've used a multi row formula to try and tackle this problem. Here are my steps:

1) Create a column which is the numeric value from within the original cumulative profit... column.

formula.png

 

2) Use a multi row to flag any values that are between 90 - 130. (Don't forget to group by each business)

multirow.png



3) Use a formula, to create a column, that says "include", based on the value created by the multi row formula. (we want to keep all rows with value 0 or 1).


Here's the full workflow.

 

Screenshot 2025-07-18 113159.png

I've attached the workflow with annotations below, please let me know if you have any questions

Regards - Pilsner

beelix
5 - Atom

Thanks Pilsner.  Worked very well!

Pilsner
13 - Pulsar

That's great to hear, thank you for the feedback!

Labels
Top Solution Authors