Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi Power BI Community,
I have a question regarding how to create a dynamic ranking using a matrix table that allows multi select month year.
At the moment the ranking works for single select month year but when I select additional month year the ranking doesn't work as it should.
I'm currently using the following
Rank =
RANKX (
FILTER ( ALLSELECTED ( 'CrossPurchase_Category' ), 'CrossPurchase_Category'[Category] = MAX ( 'CrossPurchase_Category'[Category] ) ),
CALCULATE ( SUM ( 'CrossPurchase_Category'[baskets] ) ),)
which gives me this when only Nov 23 is selected
But if I select Dec23 as well then the rank is no longer 1-14
Any idea how to solve this?
Solved! Go to Solution.
Thanks for the reply from @amitchandak , please allow me to provide another insight:
Hi @JaynaC ,
Maybe you can try formula like below, when i choose muti month in slicer, it works well.
Total Baskets = SUM(CrossPurchase_Category[Baskets])
Dynamic Rank =
RANKX ( ALLSELECTED ( slicer_[Category] ), [Total Baskets],, ASC, DENSE )
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from @amitchandak , please allow me to provide another insight:
Hi @JaynaC ,
Maybe you can try formula like below, when i choose muti month in slicer, it works well.
Total Baskets = SUM(CrossPurchase_Category[Baskets])
Dynamic Rank =
RANKX ( ALLSELECTED ( slicer_[Category] ), [Total Baskets],, ASC, DENSE )
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@amitchandak
Thanks for that... It's almost there I used the M1 and new rank measures however the ranking is going horizontally instead of vertically.. do you know how I could change that?
@JaynaC , Try like
Rank =
RANKX (
FILTER ( ALLSELECTED ( 'CrossPurchase_Category'[Category] ), 'CrossPurchase_Category'[Category] = MAX ( 'CrossPurchase_Category'[Category] ) ),
CALCULATE ( SUM ( 'CrossPurchase_Category'[baskets] ) ))
Or create a measure
M1= CALCULATE ( SUM ( 'CrossPurchase_Category'[baskets] ), FILTER ( ALLSELECTED ( 'CrossPurchase_Category'[Category] ), 'CrossPurchase_Category'[Category] = MAX ( 'CrossPurchase_Category'[Category] ) ) )
Try new Rank Function
Rank(dense, ALLSELECTED ( 'CrossPurchase_Category'[Category] ) orderby(M1,desc))
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |