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
Gandarthvader
Regular Visitor

Conditional Formatting Measure Highlighting Dates in Past and Future

Hello,

 

I currently have a measure created to highlight the date in a table if it's within the next 60 days YELLOW, but it also included today.

 

What I'd like to do, and can't figure out, is how to make it so that if the date in the column is today's date or before today's date, change the highlight to GREEN, and keep the dates within the next 60 days to stay YELLOW. Anything past 60 days in the future will have no highlight.

 

Below is my current measure:

 

Open Color =
var _datediff=DATEDIFF(MAX('Current'[Current OTP]),TODAY(),DAY)
return
IF(
    MAX('Current'[Current OTP])<= TODAY() + 60,"#FFFF99"
    )
 
Thank you for any help!!
1 ACCEPTED SOLUTION
cengizhanarslan
Super User
Super User

Please try the measure below:

Open Color =
VAR _Date    = MAX ( 'Current'[Current OTP] )
VAR _Today   = TODAY ()
RETURN
    SWITCH (
        TRUE (),
        _Date <= _Today,              "#92D050",  
        _Date <= _Today + 60,         "#FFFF99",
        BLANK ()
    )
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

View solution in original post

4 REPLIES 4
wardy912
Super User
Super User

Hi @Gandarthvader 

 

 Give this a try

 

Date Highlight =
VAR TargetDate = SELECTEDVALUE('YourTable'[YourDateColumn])
VAR TodayDate  = TODAY()

RETURN
SWITCH(
    TRUE(),
    TargetDate <= TodayDate, "#00FF00",        -- GREEN
    TargetDate > TodayDate && TargetDate <= TodayDate + 60, "#FFFF00",  -- YELLOW
    BLANK()
)

 

--------------------------------

I hope this helps, please give kudos and mark as solved if it does!

 

Connect with me on LinkedIn.

Subscribe to my YouTube channel for Fabric/Power Platform related content!

cengizhanarslan
Super User
Super User

Please try the measure below:

Open Color =
VAR _Date    = MAX ( 'Current'[Current OTP] )
VAR _Today   = TODAY ()
RETURN
    SWITCH (
        TRUE (),
        _Date <= _Today,              "#92D050",  
        _Date <= _Today + 60,         "#FFFF99",
        BLANK ()
    )
_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

Worked like a charm. Thank you!!

lbendlin
Super User
Super User

Open Color =
var _datediff=DATEDIFF(MAX('Current'[Current OTP]),TODAY(),DAY)
return SWITCH(TRUE(),
_datediff>60,BLANK(),
_datediff>0,"yellow",
_datediff>-60,"green"
 )

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.