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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
dhavalvyas
Contributor III
Contributor III

Create date from year

Hi,

I have year field contains 2014,2015,2016,2017 from which i want to create date,month and monthname. how can I do it.

give any suggestion.

2 Replies
its_anandrjs
Champion III
Champion III

Try this from any year field create first date and then yearstart dates and year ends based on the dates then create year,month,monthname etc fields.

TempTab:

LOAD *,MakeDate(Year) as TempDate;

LOAD * Inline

[

Year

2014

2015

2016

2017

];

Dates:

LOAD YearStart(TempDate) as MinDate,YearEnd(TempDate) as MaxDate Resident

TempTab;


LET vMinDate =Floor(Peek('MinDate',0,'Dates'));

LET vMaxDate =Floor(Peek('MaxDate',-1,'Dates'));

LOAD

Date($(vMinDate) + IterNo() -1) as DateField,

Year($(vMinDate) + IterNo() -1) as Year,

Month($(vMinDate) + IterNo() -1) as Month,

MonthName($(vMinDate) + IterNo() -1) as MonthName

AutoGenerate 1

While ($(vMinDate) + IterNo() -1) <= NUM($(vMaxDate));


OP2.PNG

MarcoWedel

can you describe your expected result?