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: 
greend21
Creator III
Creator III

Load WHERE = vVariable

I have this script that sets my variable, and if I check the variable within the program I see it is correct, in this case 5/15/18.

Temp:

Load Max(Date([CheckDate])) as MaxControlDate

FROM [lib://QVD/Controls.qvd](qvd);

LET vMaxCtrlDate = Peek('MaxControlDate');

Drop Table Temp;

I've been trying other things I've seen online but can't seem to get it right. I only want to load the info where the CheckDate is = to vMaxCtrlDate. Would anyone know how I get this to work? Each thing I try results in 0 records being loaded.

[Controls]:

LOAD Date(CheckDate) as MaxControlDate,

Recon

FROM [lib://QVD/Controls.qvd](qvd)

Where Date(CheckDate) = '$(=$(vMaxCtrlDate))'

;

11 Replies
greend21
Creator III
Creator III
Author

I ended up going a different route where I'm loading in the last 3 days to limit the data and always allow for there to be info in the load and just use set analysis in my KPI.

=Sum({<CheckDate={'$(=Max(CheckDate))'}>}Recon)

*I'm marking this as correct since I no longer need help, but it does not solve the original issue.*

vishsaggi
Champion III
Champion III

Did you try preceding load like below:

Can we know your date format you are getting in your Check Date field?

Temp:

Load Floor(Max(Date#([Check Date], 'M/DD/YYYY hh:mm:ss'))) as MaxControlDate

FROM [lib://QVD/Controls.qvd](qvd);

LET vMaxCtrlDate = Peek('MaxControlDate');

Drop Table Temp;

[Controls]:

LOAD *

WHERE MaxControlDate = '$(vMaxCtrlDate)';

LOAD  Date([Check Date]) AS MaxCheckDate,

      Floor(Max(Date#([Check Date], 'M/DD/YYYY hh:mm:ss'))) as MaxControlDate,

      Recon

FROM [lib://QVD/Controls.qvd](qvd);