Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

Creating a Custom Calendar

serj_shu
Valued Contributor

Creating a Custom Calendar

Hi, Everyone!

Today we gonna make a custom calendar:

c1.png

So, let's get started!

For instance we have a field with dates during 2017 year called "PostDate".

First of all we need to improve our data with some additional fields:

calendar:

LOAD

Date(Num('01/01/2017') + IterNo() -1) as PostDate

,WeekName(Num('01/01/2017') + IterNo() -1) as WeekNum

,WeekDay(Num('01/01/2017') + IterNo() -1) as DayName

,MonthStart(Num('01/01/2017') + IterNo() -1) as MonDate

,Month(Num('01/01/2017') + IterNo() -1) as MonName

AutoGenerate 1

While Num('01/01/2017') + IterNo() -1 <= Num('31/12/2017');

Now we have all needed fields to construct our calendar:

c2.png

The base for it is a Pivot Table object with two dimensions:

1. if(MonDate=MakeDate(2017,vCurMonth,1),WeekNum)

2. if(MonDate=MakeDate(2017,vCurMonth,1),DayName)

Where "vCurMonth" is an integer variable which contains a month number.

Note: this is very important to use exactly a variable (not a target fields w/o any if-conditions), because only this way will return to you a single value of picked date.

After that you need to define one expression:

1. day(only({1}PostDate))

Now we have our table. For making it more similar of calendar pattern we need to drag dimension with day names to columns.

And make some cosmetical things.

On Presentation tab:

1. Remove Null and Missing Symbols;

2. UnCheck "Allow Pivoting";

3. Expression values should be centered;

4. Wrap Cell Text parameter is equal 2;

Add Background color condition on Expressions tab:

if(day(only({1}PostDate))=day(only({1}MonthEnd(PostDate))) or (day(only({1}PostDate))=day(only({1}PostDate)) and only({1}PostDate)=0)

,RGB(100,150,190),

if(isnull(only(PostDate))=0 and GetSelectedCount(WeekNum)>0,RGB(100,180,100)

))

c3.png

The finishing line is to create a couple of text objects with Actions of variable changing - this will give an option to choose months.

And pay attention to Clear button, because selected dates couldn't be unselected.

c4.png

I have picked months by this way:

Pick(vCurMonth,$(=Concat({1}DISTINCT chr(39)&MonName&chr(39),',',MonDate)))

You may choose other way, for instance - create a list of months as a simple filter.

And of course, you can apply any other formats or visual clues by your taste and Client's request.

Hope you liked it and if it so - please, don't be hesitate to give a rate to this document. Thank you!

Attachments
Comments

Looks like good, Try to attach QVW if it is viewable ..

serj_shu
Valued Contributor

OMG! I forgot the file! A thousand apologizes!

detmawin
New Contributor III

Good day,

I am trying to create an action on the calendar where I can click on a day in the calendar and an event pops out.  I can achieve this if there is only one event in the week.  Do you know how I can achieve clicking on a singe selection and that single selection plus details appears in a text object even if there are multiple events in that week.  thanks much.

andymanu
Contributor

Hi Sergey,

The custom calendar is one of the handy feature that can be plugged in to number of apps we develop using qlik sense instead having a complicated filter pane and adding all the year, month, day and date fields from a master calendar.

Thanks for your effort. Could you please attached the completed qlik sense app's "qvw" file to the forum because I was getting some issue to implement the custom calendar following the steps you have specified?

Because the app qvw file you have attached contained on the load script but not the pivoting and the other components.

Look forward to hearing from you.

Thanking you in advance.

Kind regards,

Andy

andymanu
Contributor

Hi Sergey,

Another concern I got is I am working on Qlik Sense and not sure whether provides all the features you have specified.

Custom Calendar Query.jpgPlease refer above screenshot. Hope so far I have done correctly and stuck at unchecking the "Allow Pivoting".

Note

My integer variable have defined as below,

=num(month(PostDate))

Hope things should look good so far and appreciate, if you could help me with developing the calendar feature.

Awaiting for your reply.

Thanks.

Kind regards,

Andy

Version history
Revision #:
1 of 1
Last update:
‎09-30-2017 06:01 AM
Updated by: