Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nkosinde13
Creator
Creator

Week variable not working

I created this variable on the script: 

LET vLastSaturday = date(date#(weekstart(today()),'yyyy/mm/dd'),'yyyy-mm-dd');

 

Then on my data, I want to pull only sales that are before the variable date, so my where clause looks like this:

where  cast( [POLICY_CREATE_DATE] as date) < $(vLastSaturday)

The original POLICY_CREATE_DATE format is datetime so I'm formating it to yyyy-mm-dd so that it's the same as my variable. 

But when I reload the data, it gives me Operand type clash error. Please see attached screenshot and assist.

Thanks

2 Solutions

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

You need quotes:

where  cast( [POLICY_CREATE_DATE] as date) < '$(vLastSaturday)';

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

nkosinde13
Creator
Creator
Author

Thank you, your solution worked.

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

You need quotes:

where  cast( [POLICY_CREATE_DATE] as date) < '$(vLastSaturday)';

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
nkosinde13
Creator
Creator
Author

Thank you, your solution worked.