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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DanielTraub
Regular Visitor

Compare Dates with IF Function

Hi all, 
 
I have a table with some start and end dates in it. I want to compare those dates, to today. If today is within the start/end date time frame, then return a result of "in learning period". If it's before or after the period, then return results of Upcoming Pilot and Pilot in progress, respectively. See statement below. 
 
Learning Period = IF(Installations[Date Learning Period Started] <= TODAY() <= Installations[Expected Learning Period End Date], "In Learning Period",
                    IF(TODAY() > Installations[Expected Learning Period End Date], "Pilot in progress",
                       IF(Installations[Date Learning Period Started] > TODAY(), "Upcoming/Pilot Prep")
                    )
)  
 
But I keep running into the following error: 
DAX comparison operations do not support comparing values of type True/False with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.
 
How do I compare the dates but then make it work with the True/False values? 
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Learning Period =
IF (
    Installations[Date Learning Period Started] <= TODAY ()
        && TODAY () <= Installations[Expected Learning Period End Date],
    "In Learning Period",
    IF (
        TODAY () > Installations[Expected Learning Period End Date],
        "Pilot in progress",
        IF (
            Installations[Date Learning Period Started] > TODAY (),
            "Upcoming/Pilot Prep"
        )
    )
)

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

Learning Period =
IF (
    Installations[Date Learning Period Started] <= TODAY ()
        && TODAY () <= Installations[Expected Learning Period End Date],
    "In Learning Period",
    IF (
        TODAY () > Installations[Expected Learning Period End Date],
        "Pilot in progress",
        IF (
            Installations[Date Learning Period Started] > TODAY (),
            "Upcoming/Pilot Prep"
        )
    )
)

This seems to work! Didn't realize I needed that &&. Thanks so much!

tamerj1
Super User
Super User

Hi @DanielTraub 

please use

Learning Period =
VAR TodayDate =
    TODAY ()
RETURN
    IF (
        Installations[Date Learning Period Started] <= TodayDate
            && Installations[Expected Learning Period End Date] >= TodayDate,
        "In Learning Period",
        IF (
            TodayDate > Installations[Expected Learning Period End Date],
            "Pilot in progress",
            IF (
                Installations[Date Learning Period Started] > TodayDate,
                "Upcoming/Pilot Prep"
            )
        )
    )

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.