Power BI TMDL View: Create a Time Intelligence Calculation Group in Just One Click!

Power BI TMDL View: Create a Time Intelligence Calculation Group in Just One Click!


With the new Developer Mode and TMDL View introduced in Power BI, creating reusable and powerful time intelligence logic is easier than ever.

In this blog, I'll walk you through how to create a Calculation Group with just one click using the TMDL syntax – no need to go through Tabular Editor or external tools anymore.


🔍 What is a Calculation Group?

A Calculation Group allows you to create reusable logic for commonly used calculations like:

  • Year-to-Date (YTD)

  • Quarter-to-Date (QTD)

  • Month-to-Date (MTD)

  • Current Value (no filter applied)

These can be dynamically applied to any measure, drastically reducing duplication and making your model more maintainable.


🚀 One-Click Script to Create Time Intelligence Calculation Group

Simply paste the following TMDL script (Check here/download here) into the TMDL View:



createOrReplace table 'Time Intelligence' calculationGroup precedence: 1 calculationItem YTD = CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Calendar'[Date] ) ) calculationItem QTD = CALCULATE ( SELECTEDMEASURE (), DATESQTD ( 'Calendar'[Date] ) ) calculationItem MTD = CALCULATE ( SELECTEDMEASURE (), DATESMTD ( 'Calendar'[Date] ) ) calculationItem Current = SELECTEDMEASURE() column 'Show as' dataType: string sourceColumn: Name sortByColumn: Ordinal column Ordinal dataType: int64 formatString: 0 summarizeBy: none sourceColumn: Ordinal

This script will instantly add a calculation group named Time Intelligence with commonly used items like YTD, QTD, MTD, and Current.


🎥 Want to See It In Action?

I've created a detailed step-by-step video walking you through the entire process, including how to use the calculation group in your reports.

📺 [Watch the full video here]

💬 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

Popular posts from this blog

Embedding Power BI Reports in Websites and Applications: A Complete Guide

Import Microsoft Planner Data into Power BI Using Power Automate and SharePoint

Difference between Append and Merge in Power BI