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
nfowler_PDR
Helper I
Helper I

Conditional Formatting to Make Actual Hours Font Color Vary by Booked Hours

Hello,

 

I am at a blank today. Apologies. 

 

I have this report and on it are employees booked hours and their actual hours for the past 4 weeks. 

 

nfowler_PDR_0-1638468093045.png

 

Instead of the blue font in Actual Hours, I want the font to vary by color bsed on the booked hours data.

For Example:

Red font when the actual hours exceeds the booked hours

Orange font when there are actual hours and no booked hours

Blue font for when the actual hours is less than the corresponting booked hours. 

 

I have tried this in conditional formatting, but it keeps pushing me back to gradient. 

 

Sorry if there is an easy answer to this and I wasted your time. 

 

3 REPLIES 3
jeroendekk
Resolver IV
Resolver IV

Hi @nfowler_PDR 

There are a couple of ways to do this with a measure that you can you use with conditional formatting as a field value.

You could use color names in a measure

Color =
IF (
    ISBLANK ( SUM ( table[Booked] ) ),
    "Orange",
    IF ( SUM ( table[Booked] ) > SUM ( table[Actual] ), "Red", "Blue" )
)

As an alternative to the color names you could also use HEX, RGBA, HSLA codes.

For example
"Red"  
"hsla(0, 100%, 50%, 0%)"
"rgba(255,0,0,1)"
"#FF0000"


As a third option you could use the measure to generate numbers ( 1, 2, 3) an then use the measure as a rule to create conditional formatting and the manually attach colors to the result of the measure.

color1.jpg

Best regards,

Jeroen Dekker

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!

Thank you, @jeroendekk. I appreciate your time taking a look at this. 

I created the measure, but now it is not letting me use a measure as a field to base it on. 

 

 

nfowler_PDR_0-1638475625597.png

 

@nfowler_PDR 
If it is greyed out, that is supposed to mean something is wrong with the measure and it does not show an usuable color or color code.
Can you share which measure you used?
Best regards,
Jeroen

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.