Skip to content

Instantly share code, notes, and snippets.

View PBI-DataVizzle's full-sized avatar
💭
Shizzle my Vizzle 🤓

Imran Haq PBI-DataVizzle

💭
Shizzle my Vizzle 🤓
View GitHub Profile
Sparkline Line =
// Static line color - use %23 instead of # for Firefox compatibility
VAR LineColor = "%2301B8AA"
// "Date" field used in this example along the X axis
VAR XMinDate = MIN('Table'[Date])
VAR XMaxDate = MAX('Table'[Date])
// Obtain overall min and overall max measure values when evaluated for each date
let
P1 = "myParameter1",
P2 = "myParameter2",
#"Header" = Binary.ToText(Text.ToBinary(#"UserName"&":" & #"Password")),
#"BaseURL" = "https://yourwebpage.com/api/3",
#"DaysLogic" =
if
#"JIRA Days" = null
then
""
@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" +
@dm-p
dm-p / vega-lite_raincloud_plot_1.0.json
Created October 29, 2021 03:12
Deneb Raincloud Plot (Vega-Lite)
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"usermeta": {
"deneb": {
"build": "0.6.0.150",
"metaVersion": 1,
"provider": "vegaLite"
},
"interactivity": {
"tooltip": true,
// This gist containt useful pieces of DAX code
@OscarValerock
OscarValerock / 00 Tabular editor scripts
Last active March 7, 2024 12:49
Tabular editor scripts for Power BI
//This gist contains useful tabular editor scripts.
@OscarValerock
OscarValerock / 00 M Query Gists
Last active October 26, 2025 03:34
M Query Gists
// This gist containt useful pieces of M Query code
@ncalm
ncalm / powerquery-enumeration-list.m
Created December 26, 2022 19:54
M queries to inspect enumeration documentation
/*
A simple query to get the list of enumerations
*/
let
Source = Web.Page(Web.Contents("https://learn.microsoft.com/en-us/powerquery-m/enumerations")){0}[Data]
in
Source
@dgosbell
dgosbell / AutoPopulateMeasureDescriptionsFromOpenAI.csx
Last active September 9, 2025 04:58
This is a script for tabular editor that will loop through all the measures in a model and get ChatGPT to write a description of the calculation.
#r "System.Net.Http"
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key
// into the apiKey constant below
const string apiKey = "<YOUR API KEY HERE>";
const string uri = "https://api.openai.com/v1/completions";
const string question = "Explain the following calculation in a few sentences in simple business terms without using DAX function names:\n\n";
@dgosbell
dgosbell / AutoPopulateMeasureDescriptionsFromOpenAIWithDelay.csx
Last active June 25, 2025 09:11
Update Tabular Model Descriptions from ChatGPT with rate limiting logic
#r "System.Net.Http"
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
// You need to signin to https://platform.openai.com/ and create an API key for your profile then paste that key
// into the apiKey constant below
const string apiKey = "<YOUR API KEY HERE>";
const string uri = "https://api.openai.com/v1/completions";
const string question = "Explain the following calculation in a few sentences in simple business terms without using DAX function names:\n\n";