Skip to content

Instantly share code, notes, and snippets.

@samaguire
samaguire / ssms.pbitool.json
Created October 3, 2022 20:46
Launch SSMS in PBI Desktop
{
"name": "SQL Server Management Studio",
"description": "SQL Server Management Studio",
"path": "C:\\Program Files (x86)\\Microsoft SQL Server Management Studio 19\\Common7\\IDE\\Ssms.exe",
"arguments": "-S %server% -d %database% -E",
"iconData": "data:image/x-icon;base64,AAABAAUAEBAAAAEAIABoBAAAVgAAABgYAAABACAAiAkAAL4EAAAgIAAAAQAgAKgQAABGDgAAMDAAAAEAIACoJQAA7h4AAEBAAAABACAAKEIAAJZEAAAoAAAAEAAAACAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASZ9K/0mfSv9Jn0r/SZ9K/0mfSoD///8A////AP///wAAce8g////AP///wD///8A////AABx7yD///8A////AEmfSv9Jn0rASZ9KgEmfSoBJn0pA////AP///wAAce9gAHHv8ABx7zD///8A////AABx72AAce/w////AP///wBJn0r/SZ9KgP///wD///8A////AP///wD///8A////AABx76AAce/wAHHvMABx72AAce/wAHHvMP///wD///8ASZ9K/0mfSoD///8A////AP///wD///8A////AP///wD///8AAHHvoABx7/AAce/wAHHvMP///wD///8A////AEmfSoBJn0pA////AP///wD///8A////AP///wAAce8Q////AABx72AAce//AHHv8ABx7zD///8A////AP///wD///8Akev9JH/o/c1v5f35ZuP9/2/l/fkAce+gAHHvsABx72AAce/wAHHvMABx76AAce/wAHHvgABx74D///8A////AHrn/uVm4/3/ZuP9/2bj/f965/7lAHHvsABx7/8Ace//R8
@samaguire
samaguire / TurnOnCompute.ps1
Last active July 26, 2022 04:24
A quick PowerShell 7 script to turn on compute for Power BI Dataflows
#Requires -Modules @{ ModuleName="MicrosoftPowerBIMgmt"; ModuleVersion="1.2.1026" }
Connect-PowerBIServiceAccount
$workspaces = @(
"c9d2e54d-e2ae-4e40-909c-716baf07bbeb",
"ca79234f-094f-49c2-9519-453b562031a3",
"5e975ca7-6c75-419f-b73b-0393708b936d"
)
@samaguire
samaguire / Measures From Calculation Group Items.cs
Last active March 3, 2023 10:10
C# script for use in Tabular Editor 3/2.13+ to create news measures for a selected measure based on a chosen calculation group's calculation items.
using System.Windows.Forms;
// Variables
var promptForVariables = true; // Set to true to prompt the user for the defaultTimeIntelligenceName & defaultCurrentPeriodItemName
var defaultTimeIntelligenceName = "Time Intelligence"; // Used to determine the calculation group's suffix
var defaultCurrentPeriodItemName = "CUR"; // Calculation item to excluded from measure creation
var defaultMeasureExpression = // The template DAX query
"\r\n" +
"CALCULATE(\r\n" +
@samaguire
samaguire / Format All DAX v1.cs
Last active March 18, 2022 09:43
C# script for use in Tabular Editor 3/2.13+ to format all DAX expressions in a Tabular model (including Power BI Desktop).
/*
Formatting of calculated tables and calculated columns is unsupported in Power BI Desktop as at 25 Aug 2021
and will be ignored if unsupported features are not enabled in Tabular Editor
*/
// Begin Options
var useShortFormat = true;