• martin1119

Time saving scripts in Tabular Editor

I am sure you are already familiar with Tabular Editor (2 which is free and 3 the monster version that you need to pay for). Did you know though about these two scripts?

1) Format all your measure DAX expressions in one click.

2) Add a description to all your measures (the description will be the measure expression itself)

The first one is a quick win and you may have used it before.

What about the second one though? For me this is a huge thing since when working with live reports I do not need to open the dataset anymore to check measure expressions.

You can also take advantage of this when you are in edit mode in the Power BI service.

1) Let's start with formatting measure expressions. Copy this code:


Then open Tabular Editor from within your report - download it if you have not done so yet.

Go to Advance Scripting and paste the script.

Press play to run the script. This script will automatically run through all your measures and will format them with the best-practice syntax.

2) For adding descriptions to your measures, we will use this:

foreach (var m in Model.AllMeasures)
{ m.Description = m.Expression; }

Copy the script into the Advanced Script of Tabular Editor and run it.

The logic of the script is to create a description for all measures with the current measure expression (see yellow highlighted text in screenshot below).

The description of the measure will be visible when you hover over the measure. This description is especially useful if you have a live report or if you are looking at your report in the Power BI Service in edit mode.

If you have some other fantastic scripts and would like to share them, feel free to comment below.

34 views0 comments