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

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.

Reply
savulesc
Helper I
Helper I

Conditional formatting just for some cells in a matrix

I have a matrix with this structure:

NAME      Program    Actual

Kpi1R166.5
Kpi1R243.5
Kpi1R370.9
Kpi2R12
Kpi3R22
Kpi4R33

 

Name and Program are columns, Actual is a measure.

How can I use conditional formatting for the Actual field only for the first 3 cells (when NAME = Kpi1)?, so, if ACTUAL > 80% -> green , <75 -> red, between 75-80 no color.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Add a measure to set the formatting color and check for the KPI1 row like this.

Format Color = 
SWITCH ( 
    TRUE(),
    SELECTEDVALUE ( YourTable[Name] ) = "KPI1",
    SWITCH(
        TRUE,
        [Actual] <= 75, "Red",
        [Actual] >= 80, "Green"
    )
)

Then apply that measure as the background color to the value:

2022-09-25_13-04-37.jpg

View solution in original post

9 REPLIES 9
jdbuchanan71
Super User
Super User

Can you post your .pbix file (load it to drop box and share the link)?  My formula works in my test.

2022-09-25_14-37-16.jpg

I found the issue. For some reason i had to put <= "65%" in the measure. Thanks for your help.

parry2k
Super User
Super User

@jdbuchanan71 Thanks for correcting. I missed the KPI name condition but you cannot apply conditional format on a column on the row in the matrix visual, visual still need to be changed to table visual

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

jdbuchanan71
Super User
Super User

Add a measure to set the formatting color and check for the KPI1 row like this.

Format Color = 
SWITCH ( 
    TRUE(),
    SELECTEDVALUE ( YourTable[Name] ) = "KPI1",
    SWITCH(
        TRUE,
        [Actual] <= 75, "Red",
        [Actual] >= 80, "Green"
    )
)

Then apply that measure as the background color to the value:

2022-09-25_13-04-37.jpg

This is not working for me, all the rows are green even if they should not.

If your [Actual] measure is a % then you would apply it at .75 and .8 like this.

Format Color = 
SWITCH ( 
    TRUE(),
    SELECTEDVALUE ( YourTable[Name] ) = "KPI1",
    SWITCH(
        TRUE,
        [Actual] <= .75, "Red",
        [Actual] >= .80, "Green"
    )
)

I tried that already, it's still the same.

parry2k
Super User
Super User

@savulesc you cannot use conditional formatting on a column used in the rows but if you are using table visual, you can apply conditional formatting on the column on a row. Add a new measure for conditional formatting and then use table visual and apply field value for Name column using the color measure

 

Color KPI = 
VAR __actual = [Actual Measure]
RETURN
SWITCH ( TRUE(),
   __actual > .80, "Green",
   __actual < .75, "Red"
)

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I didn't really understand your response, but I don't want to use conditional formatting on the Name column , because that doesn't help me at all.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.