Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
madhubabu
New Contributor III

Needed help for generating dates from this year starting on wards to till date

Hi all,

This is the script for generating dates from year start of 2016 to end of 2016.

Cal:

load

if(RecNo()=1,YearStart(today()),date(peek(date)+1)) as date

AutoGenerate Yearend(Today())-YearStart(today())+1;

So in the same way can anyone help me with generating complete dates from January 1st 2016 to 16 th march 2016.

Thanks in advance,

Madhu

3 Replies

Re: Needed help for generating dates from this year starting on wards to till date

Hi,

Check the below script.

Let varMinDate = Num(Makedate(2016,01,01));

Let varMaxDate = Num(Makedate(2016,12,31));

Date:

LOAD

date($(varMinDate)+IterNo()-1) AS Datefield

AUTOGENERATE (1)

WHILE $(varMinDate)+IterNo()-1<= $(varMaxDate);

If you want to generate date for current year, you can change the variables as

Let varMinDate = Num(Yearstart(Today()));

Let varMaxDate = Num(YearEnd(Today()));

Partner
Partner

Re: Needed help for generating dates from this year starting on wards to till date

let vStartDate = ; num(YearStart(Today()))

let vEndDate = num(Daystart(Today()));

TempCalendar:

load recno() as DateKey,

$(vStartDate) + recno() - 1 as PeriodDate

autogenerate ($(vEndDate) - $(vStartDate) + 1);

I can walk on water when it freezes

Re: Needed help for generating dates from this year starting on wards to till date

Just missed your second question.

Current year start to till date:

Let varMinDate = Num(Yearstart(Today()));

Let varMaxDate = Num(Today());

Current Year:

Let varMinDate = Num(Yearstart(Today()));

Let varMaxDate = Num(YearEnd(Today()));