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
@PBI-DataVizzle
PBI-DataVizzle / extendedDateTable.cs
Created March 15, 2025 16:39 — forked from m-dekorte/extendedDateTable.cs
Extended Date table C# script | Compatible with Tabular Editor versions TE2 and TE3
var dateTableName = "Dates"; // Name of your date table
var dateKeyColName = "Date"; // Name of the date key column in the table
var colOperations = new List<Tuple<string, string, bool>>(){
Tuple.Create("Quarter & Year", "QuarternYear", true),
Tuple.Create("Month & Year", "MonthnYear", true),
Tuple.Create("Month Name", "MonthOfYear", true),
Tuple.Create("Month Short", "MonthOfYear", true),
Tuple.Create("Month Initial", "MonthOfYear", true),
Tuple.Create("Week & Year", "WeeknYear", true),
Tuple.Create("Day of Week Name", "DayOfWeek", true),
@PBI-DataVizzle
PBI-DataVizzle / extendedDateTable.pq
Created March 15, 2025 16:30 — forked from m-dekorte/extendedDateTable.pq
Extended Date table M function | Creates an ISO-8601 type calendar
let
fnDateTable = ( StartDate as date, EndDate as date, optional FYStartMonthNum as number, optional Holidays as list, optional WDStartNum as number, optional AddRelativeNetWorkdays as logical ) as table =>
let
FYStartMonth = List.Select({1..12}, each _ = FYStartMonthNum){0}? ?? 1,
WDStart = List.Select({0..1}, each _ = WDStartNum){0}? ?? 0,
CurrentDate = Date.From(DateTimeZone.FixedUtcNow()),
DayCount = Duration.Days(Duration.From(EndDate - StartDate)) + 1,
weekStart = Day.Monday,
HolidaysProvided = Holidays <> null,
@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
#
let
fnGetSQLServer =
let
GetSQLServerType = type function (
server as (
type text
meta [
Documentation.FieldCaption = "Server Name",
Documentation.FieldDescription = "SQL Server name",
Document.SampleValues = {"SERVER"},
/** 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
@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
/** 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
/** 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)
/** 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)
@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