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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.