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

Get Fabric certified for FREE! Don't miss your chance! Learn more

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.