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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
humam85
New Member

switch does not support comparing values of type true/false with values of type date

Hi ,
i tiried to use the folllowing formula in calucleted column to get "Yes" when dates in column (start) , fall between tow values ,
 but  i get an error 
"switch does not support comparing values of type true/false with values of type date, try to use format .... "
my dax :
Look Ahead Activity =
       SWITCH(
    TRUE(),
            DATESBETWEEN(
          'Updates'[Start],min('Updates'[Remaining Early Start]) ,min('Updates'[Remaining Early Start]) + 40
     ),"Yes",
      DATESBETWEEN(
          'Updates'[Finish],min('Updates'[Remaining Early Start]) ,min('Updates'[Remaining Early Start]) + 40
     ),"Yes",
             "No")
2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @humam85

try like:
Look Ahead Activity =
VAR _start = min('Updates'[Remaining Early Start])
RETURN
SWITCH(
    TRUE(),
    OR(
        'Updates'[Start]>= _start
            &&'Updates'[Start]<= _start + 40,
        'Updates'[Finish]>= _start
            &&'Updates'[Finish]<= _start + 40
     ),
    "Yes",
    "No"
)

View solution in original post

hi @humam85 

try like:

Look Ahead Activity =
VAR _start = DATE(2022,1,12)
RETURN
SWITCH(
    TRUE(),
    OR(
        'Updates'[Start]>= _start
            &&'Updates'[Start]<= _start + 40,
        'Updates'[Finish]>= _start
            &&'Updates'[Finish]<= _start + 40
     ),
    "Yes",
    "No"
)

View solution in original post

4 REPLIES 4
humam85
New Member

FreemanZ
Super User
Super User

hi @humam85

try like:
Look Ahead Activity =
VAR _start = min('Updates'[Remaining Early Start])
RETURN
SWITCH(
    TRUE(),
    OR(
        'Updates'[Start]>= _start
            &&'Updates'[Start]<= _start + 40,
        'Updates'[Finish]>= _start
            &&'Updates'[Finish]<= _start + 40
     ),
    "Yes",
    "No"
)

thanks for quick  reply ...
it works well
if i want to put a specific date  as 1/12/2022 rather than  /min (remaining date)/ 
in wich format can i put it inside my dax

hi @humam85 

try like:

Look Ahead Activity =
VAR _start = DATE(2022,1,12)
RETURN
SWITCH(
    TRUE(),
    OR(
        'Updates'[Start]>= _start
            &&'Updates'[Start]<= _start + 40,
        'Updates'[Finish]>= _start
            &&'Updates'[Finish]<= _start + 40
     ),
    "Yes",
    "No"
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors