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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
v-jayw-msft
Community Support
Community Support

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.

 

 

 

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

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

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.

 

 

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.