Skip to content

Instantly share code, notes, and snippets.

Avatar

Imke Feldmann ImkeF

View GitHub Profile
@IvanBond
IvanBond / GetUsername.pq
Created June 8, 2019 13:45
Get USERNAME in Power Query
View GetUsername.pq
let
Source = Folder.Contents("C:\Users"),
// filter out Public folder as it may be accessed by scripts
#"Filtered out Public" = Table.SelectRows( Source, each [Name] <> "Public"),
// sort to get last accessed in the top row
#"Sort by Date accessed" = Table.Sort( #"Filtered out Public", {{"Date accessed", Order.Descending}}),
// filter out potential system folders
#"Expanded Attributes" = Table.ExpandRecordColumn(#"Sort by Date accessed", "Attributes",
{"Kind", "ReadOnly", "Hidden", "System"},
{"Kind", "ReadOnly", "Hidden", "System"}),
@tonmcg
tonmcg / Html.GetTables.pq
Last active May 14, 2018 19:13
M Language Helper Functions for HTML Parsing
View Html.GetTables.pq
let GetTables =
(url as text) =>
let
DOM = Text.FromBinary(Web.Contents(url)),
DOCTYPE =
let
DOCTag = "<!" & Text.BetweenDelimiters(DOM, "<!", ">") & ">"
in
DOCTag,
HTMLOpeningTag =
@ImkeF
ImkeF / ComplexJsonRecord.pq
Last active November 19, 2019 11:44
TheBIccountant
View ComplexJsonRecord.pq
(URL as text) =>
let
MyJsonRecord = Json.Document(Web.Contents(URL)),
MyJsonTable= Table.FromRecords( { MyJsonRecord } )
in
MyJsonTable
@Hugoberry
Hugoberry / MatrixMultiplication.m
Last active January 29, 2018 14:59
Matrix Multiplication in Power Query M. Test example = MatrixMultiplication(#table({"A","B"},{{1,2},{3,4}}), #table({"A","B"},{{1,2},{3,4}}))
View MatrixMultiplication.m
(A,B) =>
let
//vector multiplication
dotProduct = (v1,v2) =>
List.Accumulate(
List.Zip({v1,v2}),
0,
(agg,_)=>
agg+(_{1}*_{0}))
@kucukharf
kucukharf / Finance.excel.rate.js
Last active December 28, 2022 19:36
Excel RATE() Javascript Function
View Finance.excel.rate.js
/*!
* @fileOverview Finance Excel Rate Formula Javascript Equivalent
* @version 1.0.0
*
* @author Burak Arslan @kucukharf http://www.github.com/kucukharf
* @license
* Copyright (c) 2010-2018 Burak Arslan
* Licensed under Creative Commons (CC) license
* @usage RATE($periods, $payment, $present, $future, $type, $guess)
*/