← Back to list

Macros in Power BI???

It turns out, Power BI has the capability to automate tasks in one click. It requires an external tool called “Tabular Editor 3” to get…

PBI Guy in Power BI Use Cases · 2023-12-18 20:09 · 17 claps · 2.6 min read paywalled
#tabular-editor #power-bi #macro
Open on Medium ↗
Wiki topics: EVAL · Evaluation & Benchmarks

Macros in Power BI???

It turns out, Power BI has the capability to automate tasks in one click. It requires an external tool called “Tabular Editor 3” to get this done.

Review

One of the most common use cases for this type of scenarios is Time Intelligence. With that said, we will use the following data model:

If you are using recent versions in Power BI, the Tabular Editor 3 should be already integrated:

Next, click on new C# Script (I know, it sounds a little intimidating for some of us but keep reading):

I used this script to create basic time intelligence measures based on the selected measures from the original model. As promised, in one click, the code creates a bunch of measures on the fly:

Once the code is tested and validated, you can save it as macro:

It will appear in this toolbar for future needs:

I am not going to take a credit of this functionality. Kudos to all the master minds behind Tabular Editor!

Use Cases:

  • Migration: replace power query settings and database sources
  • Repetitive tasks: if you are consultant, there are things that all data models have, such as calendar table, time intelligence, UoM conversion, etc.
  • Documentation & Troubleshooting: you can export dependencies between tables and measures.
  • Templatize data models

My Takeaway

Macros in TE3 are ok. It might require some experience with C#, DAX and Calculation Groups. It may be a little overwhelming for entry level users/developers. Ultimately, we all love VBA in Excel, and we enjoyed automating repetitive tasks using macros in excel. It’d be fantastic to have something similar in Power BI but more oriented to bookmarks, events and slicers.

References:

[embed]Useful script snippets | Tabular Editor Documentation Here's a collection of small script snippets to get you started using the Advanced Scripting functionality of Tabular…docs.tabulareditor.com

[embed]TabularEditor-Scripts/Advanced/One-Click Macros/Time Intelligence Calculation Group Creation.csx at… Scripts for Tabular Editor 2 & 3. Community driven to make your Tabular Editor experience as fast as possible. …github.com

[embed]TabularEditor-Scripts/Intermediate/Create Time Intelligence Measures Using Calculation Groups.csx… Scripts for Tabular Editor 2 & 3. Community driven to make your Tabular Editor experience as fast as possible. …github.com

I hope you enjoyed reading this article. Thanks for reading and happy dashboarding!

PBI Guy

success@ootconsulting.com

www.ootconsulting.com


메타데이터
post_id
b4e8f1adc1f7
slug
macros-in-power-bi-b4e8f1adc1f7
url
https://medium.com/power-bi-use-cases/macros-in-power-bi-b4e8f1adc1f7
canonical_url
https://medium.com/power-bi-use-cases/macros-in-power-bi-b4e8f1adc1f7
author_url
https://medium.com/@pbiguy
status
ok
fetched_at
2026-06-11 18:57:35