This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ============================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the MicrosoftPowerBIMgmt module required for managing Power BI resources. | |
# This module is installed for the current user only, to avoid system-wide changes. | |
Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser | |
# Authenticate to the Power BI Service. | |
# This step is necessary to access and manage Power BI resources. | |
Login-PowerBIServiceAccount | |
# Function to retrieve all Power BI workspaces. | |
# It fetches data from the Power BI API and handles pagination to get all workspaces. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target card = | |
// unsat, below, near, hit | |
VAR _Q1_result = "unsat" | |
VAR _Q2_result = "below" | |
VAR _Q3_result = "near" | |
VAR _Q4_result = "hit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sparkline = | |
// dummy value in a table | |
VAR _vals = { | |
( 0, 500 ), | |
( 1, 700 ), | |
( 2, 1200 ), | |
( 3, 1250 ), | |
( 4, 550 ), | |
( 5, 780 ), | |
( 6, 990 ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v5.json", | |
"transform": [ | |
{"filter": "indexof(selectedDepartments, datum['Department']) >=0"}, | |
{"fold": ["Budgeted $", "Paid $"]}, | |
{ | |
"joinaggregate": [ | |
{"op": "min", "field": "value", "as": "min"}, | |
{"op": "max", "field": "value", "as": "max"} | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// white wine dataset used from http://archive.ics.uci.edu/dataset/186/wine+quality | |
{ | |
"data": { | |
"name": "dataset" | |
}, | |
"params": [ | |
{ | |
"name": "grid", | |
"select": "interval", |
NewerOlder