Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
renjithpl
Specialist
Specialist

Calendar for MTD, Day and YTD flag

HI All,

I have a challenging question,

I want to create a calendar table with day, MTD and YTD as flag,

i want a table like below:

caldateflagsalesdate
01 January 2012Day01 January 2012
02 January 2012Day02 January 2012
03 January 2012Day03 January 2012
01 January 2012MTD01 January 2012
02 January 2012MTD01 January 2012
02 January 2012MTD02 January 2012
03 January 2012MTD01 January 2012
03 January 2012MTD02 January 2012
03 January 2012MTD03 January 2012

i want to create this for 365 days,

Explanation:

if the cal date is 1st jan for flag Day, sales date appears same as 1st jan, (for 365 days same as caldate)

if the cal date is 1st jan for flag MTD, sales date appears, same as 1st jan, and 2nd jan for flag MTD, sales date appears 1st and 2nd jan

the above table should include for YTD as well,

basically in my application, i will have a list box as Day, MTD and YTD, it should display Day, MTD and YTD sales without using if condition.

please let me know if you need more clarity on this question.

Guess we can use join to get this done, but i am not able to get the correct result.

Regards

Renjith

1 Reply
whiteline
Master II
Master II

Hi.

I think your question is similar to the accumulation calendar.

There are common load steps:

1) Create a table with distinct Date field.

2) Self-join without a key field (Date as AccumDate). << it gives you all combinations Date-AccumDate.

3) Discard combinations by condition AccumDate<=Date using where statement.

In your case you just have to add flag field in all steps.