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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Conditional formatting based on datediff

Hi Experts

I have a dimdate table which starts at 01.01.2020 and increments everyday by 1 first column in dimdate table. I want to add a second column which allows me to apply the following CF rules
Based on today's date.
1. If date in row A dimdate table is >= 50 days then red
2. If <=15 days then green otherwise Amber.

Not sure is I need to add a second column to table and CF only works on numerical values.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous  , 

Create a measure to calculate the datediff and add Conditional formatting on the measure.

Here's the sample.

Measure = DATEDIFF(SELECTEDVALUE('Table'[date1]),SELECTEDVALUE('Table'[date2]),DAY)

1.PNG

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous  , 

Create a measure to calculate the datediff and add Conditional formatting on the measure.

Here's the sample.

Measure = DATEDIFF(SELECTEDVALUE('Table'[date1]),SELECTEDVALUE('Table'[date2]),DAY)

1.PNG

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

az38
Community Champion
Community Champion

Hi @Anonymous 

you can use conditional formatting using color name or HEX-code.

see examples here https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values and https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-based-on-a-calculation


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.