Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasmahajan

variable date with where clause in loading Qv

I have following script , I want to fetch date from sql  i.e MaxDate and use this variable while loading data but not getting result.

MaxDatetrn:

Load

date(MaxDate,'DD/MM/YYYY') as MaxDate;

SQL SELECT MaxDate

FROM "QLIKVIEW_SIM_DB".dbo.MAXDT;

LET vMaxDate   =  peek('MaxDate', 0, 'MaxDatetrn');

Fact_DivisionTarget:

LOAD trim(SG_ID) as SG_ID,

    date(DivTarDate,'DD/MM/YYYY') as DivTarDate,

     DivAnnualTgt,

     DivMonthlyTgt,

     finyr,

     year,

     flag

FROM

[..\Excels\SIM\Vikas.xls]

(biff, embedded labels, table is [Sheet1$])

Where DivTarDate <= date(($vMaxDate),'DD/MM/YYYY') ;

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Try this

Where DivTarDate <= date('$(vMaxDate)','DD/MM/YYYY') ;

View solution in original post

3 Replies
anbu1984
Master III
Master III

Do you have single row with Max Date in table "QLIKVIEW_SIM_DB".dbo.MAXDT?

anbu1984
Master III
Master III

Try this

Where DivTarDate <= date('$(vMaxDate)','DD/MM/YYYY') ;

vikasmahajan
Author

single row

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.