Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ksrini
Helper I
Helper I

How to Rank and Custom Color top 2, 3-4 and 5-6 ranks dynamically using Dax

Hi All,

I have several summary tables that show Company wise summary across years per each metric. I need to custom color the top 2, top 3-4, top 5-6 ranks in each year and this applies to each metric which has separate table. For one table, I have added a rankx measure and applied conditional formatting based on it. Each year has different dataset, so I had to create 4 different measures.  If i follow same method, i may have to create 20-24 measures. How can i do the same in DAX for all metrics without creating those many measures and conditional formattings ? I can combine datasets but there are lot of calculations that are specific to each year. Request your help in this.

Sales Comparison       
 2019201820172016  Metrics to Show
Company 63993162312742887  Sales
Company 123873285626532463  Profits
Company 53085270023032723  Total expenses
Company 82926197210761582  Current Ratio
Company 22773146918252431   
Company 72610174016852821   
Company 132566168326152971  Rank
Company 92140262913622771  Top 2
Company 101948183021482970  Top 3-4
Company 11860102734702547  Top 5-6
Company 141647102515971661  Others
Company 171464203310292945   
Company 31330141318582160   
Company 161279276626041491   
Company 151189274618711638   
Company 41133289919211012   
Company 111041109121421033   

 

Thanks,

Srinivas

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @ksrini 

You need to unpivot all the year columns into one year, then show them in a matrix and set year filter separately.

https://radacad.com/pivot-and-unpivot-with-power-bi

In this way, you just need to create 4 different measures, otherwise, you need to create 20-24 measures.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @ksrini 

You need to unpivot all the year columns into one year, then show them in a matrix and set year filter separately.

https://radacad.com/pivot-and-unpivot-with-power-bi

In this way, you just need to create 4 different measures, otherwise, you need to create 20-24 measures.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Lin. Followed the approach to create fewer measures. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors