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
vtruxton
New Member

Conditional Formatting based on Time for multiple conditions

Hello Everyone,

 

I have a table that has columns Name, Time (formated as HH:MM: SS AM/PM) and a KPILight using Unichar(11044). My goal is to have the KPI Light change color based on the following:

 

If Time is +- 15 min from 3:00 PM turn KPI Light Green OR if Time is +- 15 min from 4:00 AM turn KPI Light Green, else turn KPI Light Red.

 

I've been playing around with different IF formulas in the formula bar but haven't been able to get this working. Any guidance would be greatly appreciated.

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @vtruxton 

You may try to add a time column in query editor first.For example:

a1.png

Then create a rule measure like below and use it for KPILigtht column with conditional formatting.

Rule =
IF (
    ABS ( DATEDIFF ( MAX ( 'KPI'[Time.1] ), TIME ( 15, 0, 0 ), MINUTE ) ) <= 15
        || ABS ( DATEDIFF ( MAX ( 'KPI'[Time.1] ), TIME ( 16, 0, 0 ), MINUTE ) ) <= 15,
    1,
    2
)

a1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @vtruxton 

You may try to add a time column in query editor first.For example:

a1.png

Then create a rule measure like below and use it for KPILigtht column with conditional formatting.

Rule =
IF (
    ABS ( DATEDIFF ( MAX ( 'KPI'[Time.1] ), TIME ( 15, 0, 0 ), MINUTE ) ) <= 15
        || ABS ( DATEDIFF ( MAX ( 'KPI'[Time.1] ), TIME ( 16, 0, 0 ), MINUTE ) ) <= 15,
    1,
    2
)

a1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.