Skip to content

Instantly share code, notes, and snippets.

View cbaragao's full-sized avatar

Chris Aragao cbaragao

View GitHub Profile
{
"data": {
"name": "dataset"
},
"title": {
"text": "Top Sales by Product",
"font": "Roboto",
"fontSize": 20,
"color": "black"
@cbaragao
cbaragao / ChevronTimeline.dax
Last active September 3, 2025 01:35
Dynamically show a process of dates using DAX
Chevron Timeline =
// Assume you have a table with columns: ProcessName, ProcessDate
// Example virtual table (replace with your actual table reference)
VAR ProcessTable =
DATATABLE(
"Order", INTEGER, // Ensure order column starts with 1 (first date) and sequentially puts dates in order
"ProcessName", STRING,
"ProcessDate", DATETIME,
{
{4,"End Date", "2025-03-31"},
EVALUATE
VAR __tables =
SELECTCOLUMNS(
INFO.VIEW.TABLES( ),
"ObjectId", [ID],
"ObjectType", "Table",
"Type", "N/A",
"Object", [Name],
"Desc", [Description],
"Hidden", FALSE( ),
(sharepoint_site as text) =>
let
Source = OData.Feed(sharepoint_site & "/_api/web/lists", null, [Implementation = "2.0"]),
Select_Columns = Table.SelectColumns(Source, {"Id", "Title", "ListItemEntityTypeFullName"}),
Set_Types = Table.TransformColumnTypes(
Select_Columns,
{{"Id", type text}, {"Title", type text}, {"ListItemEntityTypeFullName", type text}}
)
in
Set_Types
(sharepoint_site as text, folder_name as text) =>
let
Source =
Record.SelectFields(OData.Feed(
sharepoint_site & "/_api/web/GetFolderByServerRelativeUrl('" & folder_name & "')",
null,
[Implementation = "2.0"]
), "Files")[Files],
Select_Columns = Table.SelectColumns(
Source,
(sharepoint_site as text, list_title as text) =>
let
Source = Record.SelectFields(
OData.Feed(
sharepoint_site & "/_api/lists/getbytitle('" & list_title & "')",
null,
[Implementation = "2.0"]
),
"Fields"
)[Fields],
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Function AUTOCORR(dataRange As Range, lag As Integer) As Double
Dim n As Long
Dim i As Long
Dim mean As Double
Dim numerator As Double
Dim denominator As Double
Dim values() As Double
' Get number of points
n = dataRange.Count
-- Using DuckDb
-- Example is Lag 1
CREATE TEMP TABLE t1 (
SERIES DECIMAL(18,2)
);
INSERT INTO t1 VALUES(895);
INSERT INTO t1 VALUES(432);
INSERT INTO t1 VALUES(282);
INSERT INTO t1 VALUES(879);
function Get-RecentFiles {
param (
[string]$Path = ".",
[int]$Days = 1,
[switch]$Recurse,
[string]$Extension
)
if (-Not (Test-Path $Path)) {
Write-Error "Path not found: $Path"