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 / fn_dates_table_updated_DEBUG.pq
Created April 21, 2025 15:56
fn_dates_table_updated_DEBUG
let
/// -- DEBUG PARAMETERS is_work_day
p_year_start = null ?? Date.Year(Date.From(DateTimeZone.FixedUtcNow()))-1,
p_year_end = null ?? p_year_start+1,
p_start_date = #date(p_year_start,01,01),
p_end_date = #date(p_year_end,12,31),
p_fiscal_year_start_month_num = null ?? 4,
p_business_year_start_month_num = null ?? 3,
p_holidays = null,
p_weekday_start_num = 1,
@PBI-DataVizzle
PBI-DataVizzle / fn_dates_table_updated.pq
Created April 21, 2025 15:55
fn_dates_table_updated
let
custom_functon_fn_dates =
// 1.0: invokeFunction & define parameter inputs documentation
let
documentation = [
// Inspired by Enterprise DNA - Melissa de Korte (https://www.youtube.com/watch?v=H8F60sgQZOI)
Documentation.Name = " fnDates ",
Documentation.Description = " Dates Table with Business & Fiscal Year Calendar Fields ",
Documentation.LongDescription = "
{
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
"datasets": {
"dataset": [
{"Country": "Canada", "Segment": "Channel Partners", "Sales": 19752468},
{"Country": "Canada", "Segment": "Enterprise", "Sales": 144752736},
{"Country": "Canada", "Segment": "Government", "Sales": 428829833},
{"Country": "Canada", "Segment": "Midmarket", "Sales": 21616940},
{"Country": "Canada", "Segment": "Small Business", "Sales": 361203792},
{"Country": "France", "Segment": "Channel Partners", "Sales": 15178124},
@PBI-DataVizzle
PBI-DataVizzle / madison_vega_lite_animated_lines.json
Created March 27, 2025 19:12
easing formulas by Madison Giammaria
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"usermeta": {
"version": "01.01",
"developedBy": "Madison Giammaria",
"gitHub": "https://github.com/Giammaria",
"linkedIn": "https://www.linkedin.com/in/madison-giammaria-58463b33",
"email": "[email protected]",
"visualName": "Easing Formulas",
"visualDescription": "Here you can compare different easing functions and see their respective formulas. This isn't a comprehensive list of easing functions, but these are definitely some popular ones. Special thanks to Pavithra Kodmad for writing this excellent article on understanding easing! https://css-tricks.com/ease-y-breezy-a-primer-on-easing-functions/ A few months prior to making this, I would not have thought that this would be feasible in Vega-Lite."
@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 / debug_check_workdays.sql
Created February 3, 2025 14:22
debug_workdays_functions
DECLARE @StartDate DATE = '2025-01-10';
DECLARE @CalendarDays INT = 25;
DECLARE @EndDate DATE = DATEADD(DAY, @CalendarDays , @StartDate);
WITH Dates AS (
SELECT @StartDate AS WorkDate
UNION ALL
SELECT DATEADD(DAY, 1, WorkDate)
FROM Dates
WHERE WorkDate < @EndDate
@PBI-DataVizzle
PBI-DataVizzle / jekyll_cmd_snippets.txt
Created February 2, 2025 18:32
bundle exec auto regenerate github pages
$ bundle exec jekyll serve --livereload --incremental --force_polling
cd my-jekyll-website
$ bundle init
$ bundle add jekyll
$ bundle exec jekyll new --force --skip-bundle .
@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
#