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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AlayaLove
New Member

Conditional Formatting on Dates - 2 months

Hi All. 

 

Im currently attempting to apply conditional formatting to a date colum where the formatting is applied to turn the cell red when the date entered is 2 months or more before the current date. I'm unsure if I need to create a new column in order to do this, and if so what formula should I be using. 
Any help would be much appreciated. 


Regards, 
Alaya 

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@AlayaLove 

 

You can create a flag column using today()-60:

 

Flag = IF([Date]<=TODAY()-60,1,0)

 

 
Then use the flag column as to rule the conditional formatting.
conditional format.JPG
 

Paul Zheng _ Community Support Team
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
V-pazhen-msft
Community Support
Community Support

@AlayaLove 

 

You can create a flag column using today()-60:

 

Flag = IF([Date]<=TODAY()-60,1,0)

 

 
Then use the flag column as to rule the conditional formatting.
conditional format.JPG
 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
amitchandak
Super User
Super User

@AlayaLove , Create a measure like

Color Date =
var _min = date(year(today()),month(today())-2,day(today())) // date(year(today()),month(today())-2,1)
var _max = date(year(today()),month(today())+2,day(today())) // date(year(today()),month(today())+2,1)
return
if(FIRSTNONBLANK('Date'[Date],blank) >= _min && FIRSTNONBLANK('Date'[Date],blank) <= _max ,"red","lightgreen")

 

And use it with field option in color formatting

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.