Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have matrix and I am trying to caluate the ranking with hierachy, the dax works if the hierarchy is coming from the same table, and doesn't work if it is coming from another table.
1st level of Hierarchy
2nd level of Hierarchy
3rd level of Hierarchy
Below is the Dax I am using to create the rank function
Solved! Go to Solution.
Hi,
Thanks for your reply.
But I think there is a bug in Power BI i.e. the dax query I was using is working fine when I deleted the old matrix I was using and was working fine when I created a new matrix.
Hi @Anonymous ,
Seems like a dynamic hierarchy rankx in matrix visual, you can rerfer these articles that could help you:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Thanks for your reply.
But I think there is a bug in Power BI i.e. the dax query I was using is working fine when I deleted the old matrix I was using and was working fine when I created a new matrix.
Hi @Anonymous ,
You can refer to this article.
https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/
Regards,
HN
@Anonymous , In case of rank If you create a rank on City and even add CIty Id it will not work. For Rank measure context is very important .
In this Example on 2nd and 3rd give correct Rank with Rank City and Citym which are the lowest level in my table
City Rank = RANKX(all(Geography[City]),[Sales]) // Do work with City ID
Geography Rank = RANKX(all(Geography),[Sales]) // Table is used
City and ID Rank = RANKX(all(Geography[City],Geography[City Id]),[Sales])
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Hi @Anonymous
Can you provide what you expected as a result?
Hi,
This is how I am expecting the rank to work
Hi,
Share the link from where i can download your PBI file.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 80 | |
| 59 | |
| 51 | |
| 46 |