Skip to content

Scripts for Tabular Editor 2 & 3. Community driven to make your Tabular Editor experience as fast as possible.

License

Notifications You must be signed in to change notification settings

PowerBI-tips/TabularEditor-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tabular Editor Scripts

Community repository for sharing and discussing scripts for use with Tabular Editor. Originally forked from TabularEditor Scripts.

Using scripts from this repository

If you'd like to use a script from this repository, simply copy the script content into the Advanced Scripting pane of Tabular Editor. For more details about scripting, read this article. You may also store scripts as Custom Actions that are integrated in Tabular Editor's UI.

DISCLAIMER: THE SCRIPTS IN THIS REPOSITORY ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. You are responsible for ensuring that any scripts you execute does not contain malicious code, or does not cause unwanted changes to your tabular models. If you do not understand what the code does, do not blindly execute it! A script has access to the full power of the .NET platform, meaning it can theoretically alter system files, download stuff from the internet, etc. Do not execute a script from sources you do not trust.

How to contribute

Fork the repo, add your scripts and submit a pull request - it's that simple!

Scripts should use the .csx file extension. If you plan to submit a collection of multiple scripts, feel free to put them into a subfolder and provide a README.md file with additional documentation.

Please ensure that your script is thoroughly documented with a comment section at the top of the file. Feel free to use the following snippet as a template:

/*
 * Title: Auto-generate SUM measures from columns
 * 
 * Author: Daniel Otykier, twitter.com/DOtykier
 * 
 * This script, when executed, will loop through the currently selected columns,
 * creating one SUM measure for each column and also hiding the column itself.
 */
 
// Loop through all currently selected columns:
foreach(var c in Selected.Columns)
{
    var newMeasure = c.Table.AddMeasure(
        "Sum of " + c.Name,                    // Name
        "SUM(" + c.DaxObjectFullName + ")",    // DAX expression
        c.DisplayFolder                        // Display Folder
    );
    
    // Set the format string on the new measure:
    newMeasure.FormatString = "0.00";

    // Provide some documentation:
    newMeasure.Description = "This measure is the sum of column " + c.DaxObjectFullName;

    // Hide the base column:
    c.IsHidden = true;
}

Tips and tricks

  • When trying to add quotation marks for string value (aka quotation within quatation) the "" should be added. It is added for opening and ending quatation
  • Experiment, but make a copy of the file. If anything goes worn CTRL+Z and you will undo the script

About

Scripts for Tabular Editor 2 & 3. Community driven to make your Tabular Editor experience as fast as possible.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages