Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

anmolmalviya05

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: Download/Copy with correct Indentation from here: (Click)

🔧 Steps to Implement:

  1. Enable TMDL View in Power BI Desktop (Preview feature)
  2. Navigate to TMDL View in Power BI Desktop and Create a New Script.
  3. Paste the code (Copy with correct indentation from here) into the TMDL Script Interface (Refer below screenshot)
    2.png
  4. Click on Apply button on top left.
    3.png
  5. Calendar table will get created, click on the refresh now button.
    4.png
  6. Explore the calendar table from the Data view
    5.png
  7. Note: If you want to change the date range or FY Start month then you can change it in the variables created in line 72,73 & 74. (Screenshot attached)
    6.png

🎥 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

📍 Follow my blog series for more such Power BI TMDL tips and tricks!


Proud to be a Microsoft Fabric community super user


Let's Connect on LinkedIn


Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.

Comments