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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DebbieE
Community Champion
Community Champion

Conditional formatting background colour of a table field

I have the following tables and columns to use for this

 

ColourFormattingIssue.JPG

And I want to conditionally colour the Table Field based on the Fact and the Lookup %

So for example

 

Group                 Fact              Lookup %

Group1               79.1%          85%

 

If Fact The Same or Greater than Lookup % Then Green

If Fact 10% Under     Lookup % Then Amber

If Fact Greater that 10% Under Lookup % Then Red

 

But I don’t think I can do it . All I have is the following

BackgroundColourFormatting.JPG

Is there any way of setting up formatting against another data item in the way specified above?

2 ACCEPTED SOLUTIONS

@DebbieE it is pretty easy, actually you can create a measure to define the logic for the color and then use that in conditional formatting by selecting field value from drop down

 

something like, so you can put your logic in following measure and use this My Background Color for conditional formatting.

 

My Background color =
SWITCH( TRUE()
    Measure A > Measure B, "Green",
    Measure A = Measure B, "Yellow",
  "Red"
)


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

DebbieE
Community Champion
Community Champion

I need to use a between I think and I dont think you can use BETWEEN in a Switch.

 

I think I may have some working DAX

 

My Background color =

IF([Avg Fact]>=AVERAGE('lookup SurveyGoals'[Goal]),"Green" ,
IF([Avg Fact]<AVERAGE('lookup SurveyGoals'[Goal]) && [Avg Fact]>= AVERAGE('lookup SurveyGoals'[Goal - 10]),"Yellow",
"Red"
))
 
Just to try and add it to my formatting now. Fingers crossed

 

 

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@DebbieE you have percent option select in first set of condition, change it to number.



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.

DebbieE
Community Champion
Community Champion

That was just something I did quickly to show that I cant format against another field in a table. 

@DebbieE it is pretty easy, actually you can create a measure to define the logic for the color and then use that in conditional formatting by selecting field value from drop down

 

something like, so you can put your logic in following measure and use this My Background Color for conditional formatting.

 

My Background color =
SWITCH( TRUE()
    Measure A > Measure B, "Green",
    Measure A = Measure B, "Yellow",
  "Red"
)


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.

DebbieE
Community Champion
Community Champion

MyBackgroundColour.JPGI started to try and create that measure (Its definitely a measure)

 

But it doesnt allow me to select my Average Measure that is already set up as a measure 

@DebbieE hmmm, very hard to say why, if you adding this as a measure and you already have anotehr measure, you should able to refer existing measure. no idea how to debug without actually looking at it.



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.

DebbieE
Community Champion
Community Champion

I need to use a between I think and I dont think you can use BETWEEN in a Switch.

 

I think I may have some working DAX

 

My Background color =

IF([Avg Fact]>=AVERAGE('lookup SurveyGoals'[Goal]),"Green" ,
IF([Avg Fact]<AVERAGE('lookup SurveyGoals'[Goal]) && [Avg Fact]>= AVERAGE('lookup SurveyGoals'[Goal - 10]),"Yellow",
"Red"
))
 
Just to try and add it to my formatting now. Fingers crossed

 

 

@DebbieE  IF condition is also fine but I like to use Switch it is easy to maintain and readbility point of view. Yes between can be used using and , anyhow let's if you get thru IF and then you have the solution.



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.

DebbieE
Community Champion
Community Champion

Its all working,

 Thank you so much

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.