Skip to content

Instantly share code, notes, and snippets.

let fnCreateDimTables =
(t as table, optional exclusions as list) =>
let
// Get the schema for the table
Schema = Table.Schema(t),
// Select the text columns
AllTextCols = Table.SelectRows(Schema, each _[Kind] = "text")[Name],
let fnCreateDimID =
(fact as table, col_name as text)=>
let
fnCreateDim = (fact as table, col_name as text)=>
let
removed_cols = Table.SelectColumns(fact,{col_name}),
dedupe = Table.Distinct(removed_cols),
sorted = Table.Sort(dedupe,{{col_name, Order.Ascending}}),
@gustavoleo
gustavoleo / ExportAllReports.ps1
Last active December 9, 2021 16:43 — forked from Erik-H-zz/ExportAllReports.ps1
Adding Power BI Dataflows
#Log in to Power BI Service
Login-PowerBI -Environment Public
#First, Collect all (or one) of the workspaces in a parameter called PBIWorkspace
$PBIWorkspace = Get-PowerBIWorkspace # Collect all workspaces you have access to
#$PBIWorkspace = Get-PowerBIWorkspace -Name 'My Workspace Name' # Use the -Name parameter to limit to one workspace
#Now collect todays date
$TodaysDate = Get-Date -Format "yyyyMMdd"
@gustavoleo
gustavoleo / py.bat
Created September 18, 2020 17:38
Batch to run Python script from cmd
@echo off
SET RUN_DOTPY=python.exe mercurial.py
SET PYTHON_PATH=C:\dev\Python27
set SCRIPT=
REM Hunt around for python
IF EXIST "python.exe" (
@gustavoleo
gustavoleo / power-query-pagination.m
Created September 14, 2020 18:24 — forked from MarkTiedemann/power-query-pagination.m
Power Query Pagination Example
let
BaseUrl = "https://fake-odata-api.com/v1/Entities?",
Token = "F4K3-T0K3N-D0NT-U5E-L0L",
EntitiesPerPage = 1000,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
@gustavoleo
gustavoleo / power-query-pagination.m
Created September 14, 2020 18:24 — forked from MarkTiedemann/power-query-pagination.m
Power Query Pagination Example
let
BaseUrl = "https://fake-odata-api.com/v1/Entities?",
Token = "F4K3-T0K3N-D0NT-U5E-L0L",
EntitiesPerPage = 1000,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
{
"version": "1.0",
"name": "[Tool Name]",
"description": "[Tool Description]",
"path": "C:\\[PATH TO PYTHON EXECUTABLE]\\python.exe",
"arguments": "C:/[PATH TO PYTHON SCRIPT].py \"%server%\" \"%database%\"",
"iconData": "data:image/png;base64,[YOUR BASE64 IMAGE CONTENT]"
}
{
"version": "1.0",
"name": "[Tool Name]",
"description": "[Tool Description]",
"path": "C:\\[PATH TO PYTHON EXECUTABLE]\\python.exe",
"arguments": "C:/[PATH TO PYTHON SCRIPT].py \"%server%\" \"%database%\"",
"iconData": "data:image/png;base64,[YOUR BASE64 IMAGE CONTENT]"
}