Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calendar problem

Dear all,

how can I create a calendar having the year values only ?

For example:

periodo between  2010  and 2012

Is is possible without a range date ?

Thanks in advance

1 Solution

Accepted Solutions
MayilVahanan

HI

Ya , its give.. For additional information..

Try like this

Let vEnd = Num(Today(1));

Let vStart = Num(YearStart($(vEnd),-4)) - 1;

Generate:

LOAD Date($(vStart) + IterNo()) AS Date , num((rand() * 100) + 1000, '##0') as Sales

AutoGenerate 1

While ($(vStart) + IterNo()) <= $(vEnd);

Tablename:

LOAD Month(Date)*1 AS MonthKey1, Month(Date) as Month,Year(Date) AS Year,Day(Date) AS Day,Num(Date) as DateNUm ,

Dual('Q' & Ceil(Month(Date) / 3) & ' ' & Year(Date), QuarterName(Date)) as Quarter,

MonthName(Date) as Monthyear

Resident Generate;

Hope that helps..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
MayilVahanan

Hi

I think , if i understand your requirement, r u looking like this?

Load

Year(DateField) as Year,

Sales

From TableName;

Its load year and sales value only..without load the date field.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Yes, but I solved maybe.

I created the calendar by the makedate function: makedate(firstyear, 01,01) as mindate and makedate(lastyear,12,31) as maxdate. It should be correct, I hope...

Thanks for your attention

stefan

MayilVahanan

HI

Ya , its give.. For additional information..

Try like this

Let vEnd = Num(Today(1));

Let vStart = Num(YearStart($(vEnd),-4)) - 1;

Generate:

LOAD Date($(vStart) + IterNo()) AS Date , num((rand() * 100) + 1000, '##0') as Sales

AutoGenerate 1

While ($(vStart) + IterNo()) <= $(vEnd);

Tablename:

LOAD Month(Date)*1 AS MonthKey1, Month(Date) as Month,Year(Date) AS Year,Day(Date) AS Day,Num(Date) as DateNUm ,

Dual('Q' & Ceil(Month(Date) / 3) & ' ' & Year(Date), QuarterName(Date)) as Quarter,

MonthName(Date) as Monthyear

Resident Generate;

Hope that helps..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Thanks, really much more complete.