
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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 🙂
