Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielrogra
Creator
Creator

Using variable in SQL where clause

Hi all

I'm facing an issue I can't solve although there is some information on internet....

I want to create a variable with contains just a date like this:

LET vMaxDate = peek('MaxDate');

Then, I want to use it in a SQL where clause, like this:

and datediff(mm,start_date,$(vMaxDate)) between 0 and 11

But it's not working...I've also tried doing the following:

and datediff(mm,start_date,'$(vMaxDate)') between 0 and 11

But still not working....I'm sure there is something I'm missing but I am not able to see it.

Does anyone know how to fix it? Thanks in advance

Daniel

10 Replies
eduardo_dimperio
Specialist II
Specialist II

Hi Daniel,

Using debug function, what you have in LET vMaxDate = peek('MaxDate');?