Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I am looking for a way to exclude the top 10% and bottom top 10% of values by category for a calculated column.
Here is some sample data.
The "Regional CY MTD" and "Regional LY MTD" columns are the sum of CY MTD and LY MTD for all customers in those respective regions. Here is the code for the calcuation.
Try these 4 DAX, you got any questions or need more info, just hit me up!
YoY MTD Rank =
RANKX( FILTER( 'Table', 'Table'[Sales Region Name] = EARLIER('Table'[Sales Region Name])),
'Table'[YoY MTD Diff],, ASC,DENSE)
---------------
Total Accounts =
CALCULATE( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Sales Region Name]))
----------------
Regional CY MTD (Filtered) =
CALCULATE(SUM('Table'[CY MTD]),
FILTER('Table','Table'[YoY MTD Rank] > (0.1 * [Total Accounts]) &&'Table'[YoY MTD Rank] <= (0.9 * [Total Accounts])),DATESMTD('Table - Calendar'[Date]),ALLEXCEPT('Table', 'Table'[Sales Region Name]))
----------------
Regional LY MTD (Filtered) =
CALCULATE(SUM('Table'[LY MTD]),FILTER('Table', 'Table'[YoY MTD Rank] > (0.1 * [Total Accounts]) &&
'Table'[YoY MTD Rank] <= (0.9 * [Total Accounts])),DATESMTD('Table - Calendar'[Date]),
ALLEXCEPT('Table', 'Table'[Sales Region Name]))
Hi @rjafri2015
I believe you should be able to achieve what you want using RANKX along with some other measures. Here is a great article that describes the steps in achieving hoepfully what you are after: https://www.burningsuit.co.uk/find-top-or-bottom-n-percent-dax/
Hope this helps!
Theo
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Sorry for digging an old topic, but this is the first result that pops when searching this issue.
It seems that the behavior of RANKX has changed since then, because
Customers Ranked Top = RANKX (Customers,[_Total Sales])doesn't work anymore. It should be changed this way :
Customers Ranked Top = RANKX (ALL(Customers),[_Total Sales])See video from Benjamin Ejzenberg (in French) Power bI DAX Challenges - 05 RANKX
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.