Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
laurencowie
Regular Visitor

% of total using dynamic filters but unaffected by TopN filter

Hello! Hopefully somebody can help...

 

Is it possible to calculate a percentage total which changes dynamically based on other filters/slicers on the page, but is not affected by filtering the table to show the top 10 results?

 

For example, I have sales by date, business and category. For each of these I will have a slicer to allow a subset to be considered. I have calculated the %Total Sales, so that if I have all the data, its the percentage of all sales, but if I choose for example just one business, it´s the percentage of that business:

 

All data combined:

 

DateBusinessCategorySalesPercentRank
01/07/2018A110011%4
01/07/2018A215017%2
01/06/2018A112514%3
01/07/2018B1759%6
01/07/2018B2253%7
01/07/2018C130034%1
01/07/2018C210011%4

 

 

 

Filtered for Business A:

 

DateBusinessCategorySalesPercentRank
01/07/2018A110027%3
01/07/2018A215040%1
01/06/2018A112533%2

 

 

Now, I want to only show the top observation based on the variable percent. If I just say, filter for highest percentage, or for rank=1, it recalculates the percentage to be 100%. Can I change it to ignore only the top n filter, and still calculate the percentage based on all other active filters?

 

Many thanks in advance!

 

 

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Sounds kind of like an ALLEXCEPT where you exclude Rank. But, I would probably try CALCULATETABLE where you change the filter for Rank to ALL('Table'[Rank]) (column version of ALL) which might remove the TOPN filter if it is based on Rank.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg.

 

I think ALLEXCEPT would work if Rank was a column, but I need it to be a measure so that it changes with the filters.

 

I have had a look at the CALCULATETABLE function but I'm afraid I don't follow what you mean, or understand exactly how to use the function. Again it seems to not like the fact that rank is a measure. Is that correct or have I misunderstood?

OK, if you post your Rank measure formula, I'll see if I can come up with a full solution.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Ok, so below is my measure for rank, and my measure for the percent_sales which is the measure I would like to change based on the other filters but not be affected by setting the table to show rank 1-10 only. (Equally, I could use the TopN filter on my BaseItems using top 10 based on Sales column if that is more straightforward, but that also doesn't seem to be working correctly with the ALLEXCEPT!)

 

Ranking= RANKX( ALL(report_excel[BaseItem]); calculate(SUM(report_excel[Sales] )))

 

percent_sales =

   VAR Sales =
       CALCULATE(SUM ( report_excel[Sales] ))
   VAR AllSales =
       CALCULATE( SUM ( report_excel[Sales] ); ALLselected('report_excel'))
   RETURN
       DIVIDE ( Sales; AllSales )

 

 

Thanks for your help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors