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
let
Switch = Function.From(
type function (value as any, l as list, default as any) as any,
(params) =>
let
// Function to select nth item of list
// If you pass in zero, you get even indices
// If you pass in one, you get odd indices
fnSelectEvenOdd = (lst as list, remainder as number) as list =>
let
@PBI-DataVizzle
PBI-DataVizzle / gist:9391809476ef82ead8bf08d79928b898
Created October 8, 2024 16:07 — forked from bjulius/gist:3aa8a47813582fd62f5949ce5dff7a0f
Batch file to extract BIM files from every PBIX file in a directory
REM Uses pbi-tools to extract the data model info and create the BIM file associated with each PBIX file in the directory
REM Batch file code written by Brian Julius, October 8, 2024
REM @echo off
SETLOCAL ENABLEDELAYEDEXPANSION
REM ============================================================
REM Batch Script to Extract BIM Files from PBIX Files
REM All PBIX files are in C:\test
REM All BIM files will be written to C:\test\bim_files
REM ============================================================
@PBI-DataVizzle
PBI-DataVizzle / gist:6b575da16c970a441e40b211ecb685b4
Created October 26, 2024 19:45 — forked from bjulius/gist:ff2d3e50dd36b7bbe5cb5f757ee0d467
DAX SVG Measure to Generate IBCS-Style Bullet Charts
//Created by Brian Julius, 23 Oct 2024 using AI model o1-P
BulletChartSVG =
VAR __TotalSales = [Total Sales]
VAR __TargetSales = [Current Year Sales Target]
-- Normalize the bars by using the maximum target sales across all data
VAR __MaxTargetSales = [Max Sales Target]
-- Scale the bars based on the maximum target sales
/** DistinctListSort */
/*
FUNCTION NAME: DistinctListSort
DESCRIPTION: Given a n-row by 1-column range of concatenated text,
returns a n-row by 1-column array of the unique values. Return
array is sorted
ARGS:
rng: Range holding original values
delim: Delimiter used to split the concatenated strings
col: Column index you want returned (1st column = 1)
/** DistinctList */
/*
FUNCTION NAME: DistinctList
DESCRIPTION: Given a n-row by 1-column range of concatenated text,
returns a n-row by 1-column array of the unique values. Not
sorted (use DistinctListSort to get sorted list)
ARGS:
rng: Range holding original values
delim: Delimiter used to split the concatenated strings
col: Column index you want returned (1st column = 1)
/** ConcatRowsFormat */
/*
FUNCTION NAME: ConcatRowsFormat
DESCRIPTION: For a rectangular array (including table refs), returns
a dynamic array 1 column wide and n rows tall, concatenating the
values from each row and applying the specified number formats
to the values from each column
ARGS:
rng: The source range to be concatenated
format: 1-row by n-column array of number formats to apply
@PBI-DataVizzle
PBI-DataVizzle / ConcatRows.txt
Created November 29, 2024 19:43 — forked from matthews-p/ConcatRows.txt
ConcatRows
/** ConcatRows */
/*
FUNCTION NAME: ConcatRows
DESCRIPTION: For a rectangular array (including table refs), returns
a dynamic array 1 column wide and n rows tall, concatenating the
values from each row
ARGS:
rng: The source range to be concatenated
delim: The delimiter to be used
skipblanks: In each row's concatenation, TRUE skips blank
/** GetDistanceMiles */
/*
FUNCTION NAME: GetDistanceMiles
DESCRIPTION: Returns the distance in miles between points X and Y based on their
decimal latitude and longitude coordinates
ARGS:
LatX: Point X's decimal latitude
LngX: Point X's decimal longitude
LatY: Point Y's decimal latitude
LngY: Point Y's decimal longitude
let
fnGetSQLServer =
let
GetSQLServerType = type function (
server as (
type text
meta [
Documentation.FieldCaption = "Server Name",
Documentation.FieldDescription = "SQL Server name",
Document.SampleValues = {"SERVER"},
@PBI-DataVizzle
PBI-DataVizzle / GitHub Pages Jekyll Dockerfile
Created February 2, 2025 07:19 — forked from BillRaymond/GitHub Pages Jekyll Dockerfile
GitHub Pages and Jekyll Dockerfile
# "#################################################"
# Dockerfile to build a GitHub Pages Jekyll site
# - Ubuntu 22.04
# - Ruby 3.1.2
# - Jekyll 3.9.3
# - GitHub Pages 288
#
# This code is from the following Gist:
# https://gist.github.com/BillRaymond/db761d6b53dc4a237b095819d33c7332#file-post-run-txt
#