Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

Variable Issue

I want to load data belonging to the latest batch of data.

I created a max date for data i receive form a database.


Load Max(Date(Date#(MONTH_BATCH,'YYYY-MM'),'YYYY-MM')) as MaxDate

resident Test ;

Let vMaxDate = Date(Date#(peek('MaxDate', -1),'YYYY-MM'),'YYYY-MM')

When I load the data form the qvd with all the data, I plan to use the vMaxDate variable in the where clause.

The variable returns the right value ie., '2012-05' when i check it in a text box with the expression '=vMaxDate'

But when I use =$(vMaxDate), the value it returns is 2007.

What could be the issue here?

1 Reply

Variable Issue

Hi Bharath,

Your date is being evaluated as string so when you expand the variable vMaxDate QV is interpreting it as 2012 - 5 which equals 2007.

To have it evaluate to a date remove the date function like this:


Load Max(Date#(MONTH_BATCH,'YYYY-MM'),'YYYY-MM') as MaxDate

resident Test ;

And to set it to the variable:

Let vMaxDate = peek('MaxDate', 0);

The variable will then be 41030 which is May 1, 2012.