Locked lesson.
About this lesson
Every model that will perform any kind of date/calendar intelligence must have a proper calendar table. This lesson gives you the tips that you can apply to any model to build a calendar table that dynamically updates with your data.
Exercise files
Download this lesson’s related exercise files.
Creating Dynamic Calendars - Theory.docx66.7 KB Creating Dynamic Calendars - Theory - Solution.docx
66.8 KB
Quick reference
Creating Dynamic Calendars - Theory
An overview of creating a dynamic self-updating calendar for your model.
When to use
When you need to build a calendar table on the fly that covers your entire data range.
Instructions
The general process is:
Create StartDate and EndDate queries
- Create a StartDate query that drills down to the earliest possible date in your data
- Create an EndDate query that drills down to the latest possible date in your data
Create the Calendar Table
- Create a new blank query
- In the formula bar enter the following formula:
={Number.From(StartDate)..Number.From(EndDate)}
- Convert your list to a table
- Change the column’s Data Type to Date
- Rename the column to Date
- Add any other desired columns (e.g. year, month, end of month)
Hints & tips
- If you are going to perform any data analysis, you should ALWAYS have a proper calendar table in your model that spans the entire fiscal year
- Failure to have a good calendar can lead to misstated results due to gaps in your Fact tables
Lesson notes are only available for subscribers.