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

How to created a RAG conditional format on a HH:MM:SS time value?

So I have a table of data which contains times. I want the table of times to display a background colour behind the value as either Red, Amber or Green. It will work as follows.

 

00:00:00 > <= 00:20:00 = Green

00:20:00 > <= 00:22:00 = Amber

Anything greater  than 00:22:00 = Red

 

I want to set colours through the conditional formating tool to show the above. Conditional formating values on Power BI seem to only work as a numerical value or percentage. As time is neither of these, i am unable to do conditional formating.

 

Can anybody suggest a way in which this can be done please?

6 REPLIES 6
alexw94
Helper I
Helper I

@ghoshabhijeet @GH  this is what I am trying to do, see attached screenshot of power bi data table, also see attached key for RAG colours, please can you help?RAG key.pngTime RAG creating request.png

MFelix
Super User
Super User

Hi @alexw94 ,

 

Power BI has a formula that is time you can create something similar to this:

 

Color =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table (3)'[Time] ) > TIME ( 0, 0, 0 )
        && SELECTEDVALUE ( 'Table (3)'[Time] ) <= TIME ( 0, 20, 0 ), "#4CAF50",
    SELECTEDVALUE ( 'Table (3)'[Time] ) > TIME ( 0, 20, 0 )
        && SELECTEDVALUE ( 'Table (3)'[Time] ) <= TIME ( 0, 22, 0 ), "#FFC107",
    SELECTEDVALUE ( 'Table (3)'[Time] ) > TIME ( 0, 22, 0 ), "#F44336"
)

MFelix_0-1684274381526.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Is this a measure what you have created? If so, the measure is not picking up the time values in my data table, the time values I have in my data table are from another measure. 

ghoshabhijeet
Solution Supplier
Solution Supplier

@alexw94  Thanks for your query. Please provide some sample data.

I will try, it will be difficult. 

@alexw94  If you wish you can share some sample data. May be I can help.

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.