Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Function 'SWITCH' does not support comparing values of type True/False with values of type Date.

Hello all, I am trying to create a condition in DAX using a String and the same time a date range. But I got this error: Function 'SWITCH' does not support comparing values of type True/False with...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Datesbetween() returns a single-column date table. The formula cannot be compared with a table using Boolean values, so an error is reported.

    DATESBETWEEN

     

    I guess what you want to find is to match the rows of 'TOTAL' [Orig Policy Start Date] that meet between DATE(2015,01,01) and DATE(2015,06,30). Please try this:

    course length 1 =
    IF (
        'TOTAL'[Graduation Institution] = "TAFE SA",
        IF (
            MAX ( 'TOTAL'[Orig Policy Start Date] ) >= DATE ( 2015, 01, 01 )
                && MAX ( 'TOTAL'[Orig Policy Start Date] ) <= DATE ( 2015, 06, 30 ),
            1,
            0
        ),
        0
    )

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data