Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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, @v-jayw-msft
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
100 | |
72 | |
44 | |
38 | |
29 |
User | Count |
---|---|
156 | |
92 | |
62 | |
44 | |
41 |