Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
I am relatively new to DAX and I have been trying to use RANKX to filter the top 3 medalists as seen below.
This is the result, which is true (Neglecting the total)
But the moment I try to map the ID to name and gender (both are in another table, see below) it starts to acting in a unexpected way. For Example (is this top 3 for each gender?)
This is what I am trying to achieve (This was by using Top N in the Filter panel but I want to use DAX instead).
Data model
Hi @Anonymous ,
Can you share some sample data so that we could check the formula?
Best Regards,
Jay
Hi, @Anonymous
This is just a personal project to gain hands on experience using Power BI, so feel free to view the whole file.
I created a report page called "TESTING TOP N" where you can check the formula and what I am trying to achieve.
Thank you in advance.
You can try an expression like this one.
Top 3 Medal Count =
VAR top3 =
TOPN ( 3, ALLSELECTED ( 'Medalists'[ID] ), [Total Medals Medalists], DESC )
VAR result =
CALCULATE ( [Total Medals Medalists], KEEPFILTERS ( top3 ) )
RETURN
result
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@Anonymous , Try TOPN
example
calculate([total medal medlist],TOPN(3,allselected(Table[ID]),[total medal medlist],DESC), values(Table[ID]))
TOPN: https://www.youtube.com/watch?v=QIVEFp-QiOk&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=42
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
72 | |
71 | |
69 | |
42 | |
42 |
User | Count |
---|---|
47 | |
41 | |
28 | |
27 | |
26 |