Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jennifer1990
New Contributor

Using a variable to load Data

I have a data set from 2006-2016 with the last date being 6/23/2016. I would like to use a variable to load a specific range from 2/15/2010 to the most current date 6/23/2016. I started by creating a start and end date by typing,

vStartDate = Date('2/15/2010')

vEndDate = Date('6/23'2016')

For this specific set I am looking to only load data between these dates. The Dateformat is set to "M/D/YYYY" if that helps at all. Any guidance where to start would be much appreciated.

Jen.

4 Replies
dwforest
Valued Contributor

Re: Using a variable to load Data

typo in End Date?

vEndDate = Date('6/23'2016')


vEndDate = Date('6/23/2016')


If my code, I also use LET with the assignment.

Make sure whereever your using the value understands it as a date as well, Qlik may return a string or a number; you may have to format:

Qlik qvd:

START_TIME >= Date('$(Start_Date)')

oracle:

TIME >= to_Date('$(Start_Date)','M/D/YYYY')

adj29block
New Contributor III

Re: Using a variable to load Data

Bonjour,

Use Makedate

LET vStartDate = Num(Makedate(2010,2,15)); //MinDate as the 15 feb 2010

LET vEndDate = Num(Makedate(2016,6,23));//MaxDate as the 23 jun 2016

Test in text box

='MinDate :' &' '& Date($(vMinDate),'DD/MM/YYYY')

='MaxDate : &' '& Date($(vMaxDate),'DD/MM/YYYY')

Have a good day

J-B

adj29block
New Contributor III

Re: Using a variable to load Data

Sorry

For the test replace with : vMinDate and vMaxDate by vStartDate and vEndDate.

MinDate as StartDate; MaxDate as EndDate

J-B

sasiparupudi1
Honored Contributor III

Re: Using a variable to load Data

Let vStartDate = Date(Date#('2/15/2010','M/DD/YYYY'),'M/DD/YYYY');

Let vEndDate = Date(Date#('6/23/2016','M/DD/YYYY'),'M/DD/YYYY'); 

Community Browser