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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Horizontal Conditional Formatting in Matrix Visual

Hello, 

i need to apply conditional formatting in matrix visual in powerBI (top 3 value in each rows).

I Tried top n in dax but it did not worked for me . 

ex- below snapshot for refrence

Dhrutivyasa070_0-1676983933488.png

Thanks in advance.

Dhruti

 

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Here's a measure expression that shows one way to do it. Just use this measure as the Field for conditional formatting for the measure in the matrix visual. Note that if you have a sort-by column on your month, you'll need to include that in the measure too.

 

ppm1_0-1676984755345.png

 

Top3MonthColor =
VAR thismonth =
    MIN ( 'Date'[Month] )
VAR top3Mos =
    TOPN ( 3, ALLSELECTED ( 'Date'[Month] ), [Total Qty], DESC )
RETURN
    IF ( thismonth IN top3Mos, "Light Green" )

Pat

Microsoft Employee

View solution in original post

1 REPLY 1
ppm1
Solution Sage
Solution Sage

Here's a measure expression that shows one way to do it. Just use this measure as the Field for conditional formatting for the measure in the matrix visual. Note that if you have a sort-by column on your month, you'll need to include that in the measure too.

 

ppm1_0-1676984755345.png

 

Top3MonthColor =
VAR thismonth =
    MIN ( 'Date'[Month] )
VAR top3Mos =
    TOPN ( 3, ALLSELECTED ( 'Date'[Month] ), [Total Qty], DESC )
RETURN
    IF ( thismonth IN top3Mos, "Light Green" )

Pat

Microsoft Employee

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.