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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
aar1
Regular Visitor

Conditional Formatting based on 2 Measures

I have a column of due dates and I want to check if 60 days have passed since the due date. If so, I would like to apply conditional formatting and highlight late entries in yellow. 

If 120 days have passed since the due date I would like to highlight the entries in red.

I have created 2 measures, one checking if its 60 days late and another checking if 120 days late. If today's date is less than 60 days or 120 days past or if the value is blank the measure returns 0. If not it returns 1.

Measure 1:

Is60DaysPast = IF (OR(TODAY()< MAX('OAT Database List'[ExpectedNextStageDatePlus60]),
                    MAX('OAT Database List'[ExpectedNextStageDatePlus60])=BLANK()
                    )
                ,0,1)
Measure 2:
Is120DaysPast = IF (OR(TODAY()< MAX('OAT Database List'[ExpectedNextStageDatePlus120]),
                    MAX('OAT Database List'[ExpectedNextStageDatePlus60])=BLANK()
                    )
                ,0,2)
 
Now my problem is Power BI's conditional formatting for one column only allows to base the rules from a single measure. Basically I want to do:
IF Is60DaysPast = 1 then yellow OR Is120DaysPast= 1 then red.
Is there another way to do the conditional formatting or consolidate the two measures?
 
aar1_0-1686932717291.png

 

 
 
1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@aar1 ,

You do not need to create separate measures.  Create a new Calculated Column:

 

DaysPastDue = DATEDIFF( [DueDate],  Today(), DAY )

 

DueDate         DaysPastDue

01/15/2023 152
04/15/2023 62
05/15/2023 32
06/16/2023 0

Then base your conditional formatting on this calculated column.  Follow these steps:

rsbin_0-1686937195108.png

I trust this is close to what you are looking for and helps you on your way.

Regards,

View solution in original post

1 REPLY 1
rsbin
Super User
Super User

@aar1 ,

You do not need to create separate measures.  Create a new Calculated Column:

 

DaysPastDue = DATEDIFF( [DueDate],  Today(), DAY )

 

DueDate         DaysPastDue

01/15/2023 152
04/15/2023 62
05/15/2023 32
06/16/2023 0

Then base your conditional formatting on this calculated column.  Follow these steps:

rsbin_0-1686937195108.png

I trust this is close to what you are looking for and helps you on your way.

Regards,

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.