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: 
MK9885
Master II
Master II

Master Calendar Script

Hello,

I've seen many users here asking the questions about how to get previous month, week, year, quarter data.

This can be done directly into the Master calendar to avoid any confusion when writing a set expression and getting it wrong.

We can simply create flags for each field and use it in our front end as ....Flag={1}........

I'm attaching the Master Calendar script I've created to do same and it might be helpful for others to just use sum({<LastMonthFlag={1}}>}Sales) rather than using

sum({<Month={$(=Month(AddMonths(Max(Date),-1)))}>}Sales) to get previous month's sale.

It also has Last quarter flags, Last month last per quarter flag, last year flag, current quarter, current month, weekend dates etc....

I edited this script as I wanted to skip those long syntax used in Set Analysis to get previous month/year.

All you need to do is copy the script as it is from the attached document and run it. And DateID will be your key matching to your Fact Dates, hence you need to convert the dates in your fact to same format as DateID from Master to link it.

You're welcome to add anything extra to it/find an error in the attached script.

Thanks.

1 Reply
PrashantSangle

Hi,

 

It is really helpful to everyone. Just one suggestion instead of posting your document as question in this group, you can post it in QilkView Docuement path. So that If any one want to refer it he / she will search in document tab.

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂