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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Gandarthvader
Regular Visitor

Conditional format date based on another date

Hello, I've found some similar suggestions to my issue, but nothing yet that has solved it. My appologies if I'm just missing something, but I have a table with a 2026 Due Date and 2026 Completion Date column. Both have dates listed. 

 

I'd like to have cells with a 2026 Due Date that is within the next 30 days to show up with a yellow back ground, or if it the 2026 Due date is past due then give it a light red background; only if the 2026 Completion Date is cell is blank.

 

But if the 2026 Completion Date is filled out I would like it to ignore the color rules in the 2026 Due Date column and have no background color since it is completed.

 

The format of the table columns are as follows: 'API Worksafe'[2026 Due Date] and 'API Worksafe'[2026 Completion Date]

 

I've attached a screenshot of the current table for a visual and marked the 2 columns that I'm working with in this question. 

 

Thank you for any help!!!

 

Gandarthvader_0-1771859324194.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can use a measure like

Cond formatting = IF(
    ISBLANK( SELECTEDVALUE( 'Table'[Completion Date] ) ),
    VAR CurrentDueDate = SELECTEDVALUE( 'Table'[Due Date] )
    VAR InNext30Days = CurrentDueDate >= TODAY() && CurrentDueDate <= TODAY() + 30
    VAR PastDue = CurrentDueDate < TODAY()
    VAR Result = SWITCH( TRUE(),
        PastDue, "red",
        InNext30Days, "yellow"
    )
    RETURN Result
)

and apply that as conditional formatting for the background for the due date.

View solution in original post

2 REPLIES 2
Gandarthvader
Regular Visitor

You are awesome! That worked like a charm. Thank you so much!!

johnt75
Super User
Super User

You can use a measure like

Cond formatting = IF(
    ISBLANK( SELECTEDVALUE( 'Table'[Completion Date] ) ),
    VAR CurrentDueDate = SELECTEDVALUE( 'Table'[Due Date] )
    VAR InNext30Days = CurrentDueDate >= TODAY() && CurrentDueDate <= TODAY() + 30
    VAR PastDue = CurrentDueDate < TODAY()
    VAR Result = SWITCH( TRUE(),
        PastDue, "red",
        InNext30Days, "yellow"
    )
    RETURN Result
)

and apply that as conditional formatting for the background for the due date.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.