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
Jackbaz93
New Member

Data Type Comparison

wk_col_FILTER = 

VAR dtToday = TODAY()
VAR dt2wk = TODAY() - 14
VAR dt4wk = TODAY() - 28
VAR dt26wk = TODAY() - 182
VAR dt52wk = TODAY() - 364
VAR dt1yrplus = MIN('OTIF - OPD'[Original Promise Date])

RETURN

IF('OTIF - OPD'[Original Promise Date] <= dtToday >= dt4wk , "2wk" )

 

This is my code (i will add the other variables at the end) but wanted to fix this first! so using this i get the "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." error. How can i fix this? ive used values and INT but must be doing something wrong. 

And how can i use switch in this? thank you 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Jackbaz93 ,

 

Update your dax.

wk_col_FILTER = 

VAR dtToday = TODAY()
VAR dt2wk = TODAY() - 14
VAR dt4wk = TODAY() - 28
VAR dt26wk = TODAY() - 182
VAR dt52wk = TODAY() - 364
VAR dt1yrplus = MIN('OTIF - OPD'[Original Promise Date])

RETURN

IF('OTIF - OPD'[Original Promise Date] <= dtToday && 'OTIF - OPD'[Original Promise Date] >= dt4wk , "2wk" )

vtangjiemsft_0-1698042082325.png

Best Regards,

Neeko Tang

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-tangjie-msft
Community Support
Community Support

Hi @Jackbaz93 ,

 

Update your dax.

wk_col_FILTER = 

VAR dtToday = TODAY()
VAR dt2wk = TODAY() - 14
VAR dt4wk = TODAY() - 28
VAR dt26wk = TODAY() - 182
VAR dt52wk = TODAY() - 364
VAR dt1yrplus = MIN('OTIF - OPD'[Original Promise Date])

RETURN

IF('OTIF - OPD'[Original Promise Date] <= dtToday && 'OTIF - OPD'[Original Promise Date] >= dt4wk , "2wk" )

vtangjiemsft_0-1698042082325.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Dangar332
Super User
Super User

hi, @Jackbaz93 

 

use convert function like below

wk_col_FILTER = 

VAR dtToday = TODAY()
VAR dt2wk = convert(TODAY() - 14,datetime)
VAR dt4wk = convert(TODAY() - 28,datetime)
VAR dt26wk = convert(TODAY() - 182,datetime)
VAR dt52wk = convert(TODAY() - 364,datetime)
VAR dt1yrplus = MIN('OTIF - OPD'[Original Promise Date])

RETURN

IF('OTIF - OPD'[Original Promise Date] <= dtToday >= dt4wk , "2wk" )

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors