March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
115 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
165 | |
116 | |
63 | |
57 | |
50 |