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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to do conditional formatting based on a measure and column from table

Hi coaches,

 

I am new to Power BI and looking forward to your help for the below.

Requirement is to create a Power BI report from the Below screenshot of a PPT slide

Marvell_0-1695457569712.png

 

Have to replicate same in Power BI

The only tables are highlighted in yellow. Rest all are text boxes.

Marvell_3-1695458069998.png

I created 3 matrix visulaizations:

Have used 2 columns: Model ID, Materiality

“Materiality” has values Level1, Level2, Level3

Created a new measure with expression Count(model ID)

I pulled Materiality in columns section, and Count(model ID) in values section and report looks like shown below

Marvell_2-1695458027425.png

 

Below are my 2 questions:

  1. I am facing issue in creating conditional formatting based on 2 columns i.e. Materiality and new measure - count(model ID)

    I want to create a new calculated column, and then use the new column in conditional formatting of background color of the cells based on below conditions:

    If Materiality = “Level1” and count(model ID)=1 then “Amber”

    If Materiality = “Level1” and count(model ID)<2 then “Green”

    If Materiality = “Level2” and count(model ID)>=5 then “Amber”

    If Materiality = “Level2” and count(model ID)<10 then “Green”

    If Materiality = “Level3” and count(model ID)>=10 then “Amber”

    If Materiality = “Level3” and count(model ID)<20 then “Green”

    Desired result is as shown below. The color code condition is different for each level1,2, 3.

    Marvell_0-1695457935608.png

    After I get the new column with values - Amber, Green, I can use this column for conditional formatting of background color of cells.

     
    2.  Need to create a table that would show the text “A” if any of the cell in left hand side matrix is yellow. In the above example, Level 1 and Level 3 have yellow background, so the right hand side table should display “A”.Marvell_1-1695457992249.png

     

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous try this:

 

Color Measure = 
VAR __Materiality = SELECTEDVALUE ( Table[Materiality]
RETURN
SWITCH ( 
   __Materiality,
   "Level 1", <<your if condition for level 1>>,
   "Level 2", <<your if condition for level 2>>,
   "Level 3", <<your if condition for level 3>>
)


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.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous try this:

 

Color Measure = 
VAR __Materiality = SELECTEDVALUE ( Table[Materiality]
RETURN
SWITCH ( 
   __Materiality,
   "Level 1", <<your if condition for level 1>>,
   "Level 2", <<your if condition for level 2>>,
   "Level 3", <<your if condition for level 3>>
)


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.

Anonymous
Not applicable

@parry2k It worked. I am so grateful for your help. Couldn't have done without your help.

Kudos!!!

Anonymous
Not applicable

Hi All, Please consider this urgent.

I am trying to create a new measure with values "red, amber, green" based on count(model ID) and materiality.

For each materiality, the condition is different.

Can somebody please help me with the below conditional statement:

Measure 3 = CALCULATE(
IF([Measure 2]<=7,"Amber", IF([Measure 2]>=8,"Red","Green")),FILTER('2a','2a'[Materiality]="level1"),
IF([Measure 2]<=10,"Amber", IF([Measure 2]>=20,"Red","Green")),FILTER('2a','2a'[Materiality]="Level2"),
IF([Measure 2]<=5,"Amber", IF([Measure 2]>=1,"Red","Green")),FILTER('2a','2a'[Materiality]="Level3")
)

 

Getting the error when I try the above

Marvell_0-1695640841406.png

 

@parry2k @amitchandak @Ritaf1983 @Ahmedx 

 

 

Anonymous
Not applicable

The sample data looks like this on which report is built. 

Marvell_0-1695459096881.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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