Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue in making Calendar

I am trying to create a calendar object . using below code

 

Calendar:

load

  (date(date#(20123112,'YYYYDDMM')+recno())) as [Calendar Date]
autogenerate 365;

this generates the calendar for 1 year  i.e is 2013 . I need to generate for for multiple year . Please can yo help .

I trie dputting For loop . but  some error is coming .

Thanks

Medha

3 Replies
er_mohit
Master II
Master II

hii

if you making calender virtually i.e master calender then try this code

LET vDateMin = Num(MakeDate(2006,1,1));

LET vDateMax = Floor(DayEnd(Today()));

LET vDateToday = Num(Today());

TempCalendar:

LOAD

$(vDateMin) + RowNo() -1 AS DateNumber ,

Date($(vDateMin) + RowNo() -1) AS TempDate

AUTOGENERATE 1

WHILE $(vDateMin)+IterNo()<= $(vDateMax);

LOAD

Date(TempDate,'DD-MM-YYYY')as TempDate,

Day(TempDate) AS CalendarDayOfMonth,

YearName(TempDate,0,2)as FiscalYear,

Year(TempDate) AS YTD

RESIDENT TempCalendar ORDER BY TempDate ASC;

DROP TABLE TempCalendar;

**************************************************************************************8

if you have a field of date in table i.e transaction table then try this

load *,

day(DATE) AS Day,

Month(DATE)AS Month,

yeARNAME(DATE,0,2) as FinancialYear,

'Q' & Ceil(Month(DATE)/3) as Quarter,

          Dual(Year(DATE) & '-Q' & Ceil(Month(DATE)/3), Year(DATE) & Ceil(Month(DATE)/3)) as YearQtr;

LOAD

date(Date#(DATE,'DD.MM.YYYY')) as date,

DATE ,

quantity

from table;

here DATE is my field

sujeetsingh
Master III
Master III

Acommon code used maximum of  times

Not applicable
Author

I have created a table Calendar having [calendar Date].

now i want to pass the value of this [calendar date] to a variable . beacuse i need to compare a date field in one of the qvd to display data for calendar date.

I am lil new to this tool ..

is there anyway to pass a field value to a variable because if i directly compare to the {calendar date ] Field . It will give error field not found as this field is not included in QVD.

Thanks

Medha