Create Calendar Table in One Click using TMDL View in Power BI
Create Calendar Table in One Click using TMDL View in Power BI
Creating a robust, reusable Calendar Table is one of the most essential steps in any data modeling process. And now with the introduction of TMDL (Tabular Model Definition Language) in Power BI, this process becomes not just easier but faster than ever—literally in one click.
In this blog, I’ll show you how you can use the TMDL View in Power BI to instantly create a rich calendar table with fiscal year handling, week numbers, month names, and more. You can also check out the step-by-step walkthrough video I’ve created for better visual understanding ๐น.
๐ What is TMDL View in Power BI?
TMDL (Tabular Model Definition Language) is a new declarative way to define tabular models in Power BI using code—making your model components (tables, columns, measures, partitions) more manageable, auditable, and reusable.
With TMDL support enabled, you can now:
-
View and edit model metadata in human-readable format
-
Create model objects directly using code (like calculated tables, measures, etc.)
-
Track and version model changes easily using source control
๐ง Why Use a Calendar Table?
Having a dedicated Calendar Table enables:
-
Proper time intelligence (e.g., YTD, MTD, QTD calculations)
-
Consistent filtering and grouping across visuals
-
Fiscal year handling
-
Easier customizations for weeks, months, quarters
⚙️ How to Create Calendar Table using TMDL View?
Here’s a sample TMDL definition for a Calendar Table you can plug into the TMDL view.
๐งพ TMDL Code:
๐ง Steps to Implement:
-
✅ Enable TMDL View in Power BI Desktop (Preview feature)
-
✅ Navigate to TMDL View in Power BI Desktop and Create a New Script.
-
✅ Paste the above code into the TMDL Script Interface (Refer below screenshot)
-
✅ Click on Apply button on top left.
-
✅ Calendar table will get created, click on the refresh now button.
๐ฅ Step-by-Step Video Guide
I've also created a detailed video tutorial showing each step from enabling TMDL to using the Calendar table in your reports.
๐ Watch now on my YouTube channel [ANMOLPOWERBICORNER]
๐ Video Link: https://youtu.be/ogEcYqf1yJI
๐ Final Thoughts
TMDL is a game-changer for Power BI developers. With just one snippet of code, you now have a full-featured, reusable Calendar Table ready to go! This will help you:
-
Save time ⏳
-
Maintain consistency across reports ๐
-
Simplify versioning and collaboration using Git ✅
๐ฌ Have questions or want to connect? Feel free to reach out to me on Anmol Malviya.
๐ Follow my blog series for more such Power BI TMDL tips and tricks!
Comments
Post a Comment