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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
jworthulf
Creator
Creator

Calculating master calendar days

Hi Guys,

I have a master Calendar setup on my dashboard

I need to find the number of  days (Monday - Sunday) currently selected on the master calendar in order to use it as part of an expression. 

LOAD

  WeekDay([SHIP DT]) as DOW,

     [SHIP DT],

     [SHIP DT] as  ship_dt,

     fiscal_year,

     fiscal_week,

     fiscal_month,

     fiscal_qtr,

     monthyr,

     quarteryr,

     weekyr,

     budget_wk

17 Replies
YoussefBelloum
Champion
Champion

Hi,

on the front end, you can do this:

Max([SHIP DT]) - Min ([SHIP DT])

and when you have selections made, you can add this:

Max({1} [SHIP DT]) - Min ({1} [SHIP DT])

maxsheva
Creator II
Creator II

Hi John,

Probably you need this GetSelectedCount(DOW)

When you make selection in DOW field it brings you number of selected days.


Would be nice to get feedback from you.

jworthulf
Creator
Creator
Author

Youssef,

I relatively new to Qlikview when you say on the "front end" are you referring to putting the formula in the Master Calendar Script?

jworthulf
Creator
Creator
Author

Max,

Thanks but this didn't give me the total calendar days for the time period I selected.   

maxsheva
Creator II
Creator II

John,

Would you clarify a meaning of calendar days for your project?

Is it week days or days from 1 to 31?

Please provide print screen what are you trying to get.

YoussefBelloum
Champion
Champion

Hi John,

Back end it is the SCRIPT, Front end is the visualisation part.

the solution i gave you, you can try it on the Front end, on "text box" object for example.

jworthulf
Creator
Creator
Author

Max,

Hi, to answer your question it is the number of days from 1 to 31

johnca
Specialist
Specialist

John, you need to supply more than just what you've given us. Is your calendar joined to your data by ship_dt (or other)? What are your selections? Are you counting calendar days or data days? Please provide more info on the nature of your data model and what you expect to get. Perhaps some sample data? Please help up help you.

Regards,

John

jworthulf
Creator
Creator
Author

John,

I have two tables a master calendar and a sales table.     The sales are based on ship dates Mon - Saturday.    The master calendar includes all days of the week...the issue is we do not have any sales on Sunday (no ship dates) so I'm only able to count 6 days using the solution that Youssef gave me.

Now I need a solution to count the number of calendar days (Mon - Sun) for the same time period.

Thanks,

JW