Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
New to Power BI so just learning but I'm trying to create a calculated measure to rank and return top 10 dependent on condition in another column.
Data example:
Country | Result |
Tunisia | 1 |
Angola | 0 |
Morocco | 1 |
Spain | 1 |
Germany | 0 |
Denmark | 0 |
Tunisia | 1 |
Denmark | 1 |
Morocco | 0 |
I want to filter out all '0' cols, then return each country aggregate, then ranked. e.g.
Tunisia - 40
Spain - 10
etc.
I amn't grasping the flow in DAX at all yet.
I've tried a few things including SUM(RANK(Table[col], ...not sure how to finish that
Top 10 =
Solved! Go to Solution.
Hi @MandoMongo ,
The Table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a table
Table 2 = SUMMARIZE(FILTER('Table','Table'[Result] <> 0),'Table'[Country],"Count",COUNT('Table'[Result]))
2.Use the following DAX expression to create a column in 'Table2'
Rank = RANKX('Table 2','Table 2'[Count],,DESC,Dense)
3.Final output
SUMMARIZE function (DAX) - DAX | Microsoft Learn
RANKX function (DAX) - DAX | Microsoft Learn
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MandoMongo ,
The Table data is shown below:
Please follow these steps:
1. Use the following DAX expression to create a table
Table 2 = SUMMARIZE(FILTER('Table','Table'[Result] <> 0),'Table'[Country],"Count",COUNT('Table'[Result]))
2.Use the following DAX expression to create a column in 'Table2'
Rank = RANKX('Table 2','Table 2'[Count],,DESC,Dense)
3.Final output
SUMMARIZE function (DAX) - DAX | Microsoft Learn
RANKX function (DAX) - DAX | Microsoft Learn
Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
78 | |
54 | |
39 | |
35 |
User | Count |
---|---|
102 | |
84 | |
48 | |
48 | |
48 |