Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 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.
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! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
145 | |
73 | |
63 | |
52 | |
51 |
User | Count |
---|---|
208 | |
91 | |
62 | |
59 | |
56 |