This file contains 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 func = | |
(Table as table, SortColumn as text, AmountColumn as text, NoOfMonthsToGoBack as number) => | |
let | |
fnRunningTotal = (Table as table, SortColumn as text, AmountColumn as text) => | |
let | |
// Sort table and buffer it | |
Sorted = Table.Buffer(Table.AddIndexColumn(Table.Sort(Table,{{SortColumn, Order.Ascending}}), "Index",1,1)), | |
// Select the Columns |
This file contains 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 func = | |
(t as type) as text => | |
let | |
nonNullableType = Type.NonNullable(t), | |
TypeDescription = if Type.Is(nonNullableType, type binary) then "binary" | |
else if Type.Is(nonNullableType, type date) then "date" | |
else if Type.Is(nonNullableType, type datetime) then "datetime" | |
else if Type.Is(nonNullableType, type datetimezone) then "datetimezone" | |
else if Type.Is(nonNullableType, type duration) then "duration" | |
else if Type.Is(nonNullableType, type function) then "function" |
This file contains 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 func = | |
(ExpandedJson as table, optional adjustDotDel as number) => | |
let | |
AdjustSkip = if adjustDotDel = null then 1 else adjustDotDel, | |
Source = ExpandedJson, | |
NameKey = Table.AddColumn(Source, "NameKey", each Text.Combine(List.Transform([Dots], (x) => Text.From(Record.Field(_,x))), " | "), type text), | |
Item = Table.AddColumn(NameKey, "Item", each Text.BeforeDelimiter([Sort], ".", {0, RelativePosition.FromEnd}), type text), | |
#"Extracted Text After Delimiter" = Table.TransformColumns(Item, {{"SortBy", each Text.BeforeDelimiter(_, ".", AdjustSkip), type text}}), | |
#"Removed Other Columns" = Table.SelectColumns(#"Extracted Text After Delimiter",{"Value", "NameKey", "Item", "SortBy"}), |
This file contains 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 func = | |
(FileOrFolderPath as text) => | |
let | |
CreateTable = if Text.End(FileOrFolderPath,5) = ".xlsx" or Text.End(FileOrFolderPath,5) = ".xlsm" | |
then #table({"Content", "Name"}, {{File.Contents(FileOrFolderPath), FileOrFolderPath}}) | |
else Folder.Files(FileOrFolderPath) , | |
FetchQueries = Table.AddColumn(CreateTable, "FetchQueries", each try fnFetchQueries([Content]) otherwise #table({"Column1"}, {{null}})), | |
#"Removed Other Columns" = Table.SelectColumns(FetchQueries,{"Name", "FetchQueries"}), |
This file contains 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 func = | |
(MyTable as table, MyColumnName as text) => | |
let | |
Source = MyTable, | |
ShiftedList = {null} & List.RemoveLastN(Table.Column(Source, MyColumnName),1), | |
Custom1 = Table.ToColumns(Source) & {ShiftedList}, | |
Custom2 = Table.FromColumns(Custom1, Table.ColumnNames(Source) & {"Previous Row"}) | |
in | |
Custom2 , | |
documentation = [ |
This file contains 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 func = | |
(MyTable as table, | |
MySearchStrings as any, | |
optional AllAny as text, | |
optional CaseInsensitive as text, | |
optional PartialMatch as text ) => | |
let | |
/* Debug Parameters ___Description for function parameters | |
MyTable = MyTable, // Table to search trough |
This file contains 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 func = | |
(filterExpression as text, | |
myColumnName as text, | |
optional MaxFilters as number | |
) => | |
let | |
/* Debug parameters | |
myColumnName = "Datum", | |
filterExpression = "DATESYTD(DimDate[Datum])", |
This file contains 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 func = | |
let | |
Source = (columnNames as text, optional topN as number, optional measureCode as text) => | |
let | |
/* Debug parameters | |
measureCode = DAXMeasureCode, | |
columnNames = "RankItem,RankMeasure, null, Rank, TopOrOthers, TopN_Others", | |
topN = 5, |
This file contains 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 func = | |
(TextToClean as text, StartDelimiter as text, EndDelimiter as text, optional RemoveDelimiters) => | |
let | |
removeDelimiters = if RemoveDelimiters = null then StartDelimiter & EndDelimiter else "", | |
Source = Text.From(TextToClean), | |
FirstSplit = List.Buffer( Text.Split(Source, StartDelimiter) ), | |
Custom2 = if List.First(FirstSplit) = "" then List.Skip(FirstSplit) else FirstSplit, | |
Custom1 = List.Transform(Custom2, each if Text.Contains(_, EndDelimiter) then Text.AfterDelimiter(_, EndDelimiter, 0) else _), | |
ListSelect = List.Select(Custom1, each _<>""), | |
TextCombine = Text.Combine(ListSelect, removeDelimiters) |
This file contains 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 func = | |
(optional Model as text) => | |
let | |
Source_Port = Folder.Files("C:\Users"), | |
msmdsrv = Table.SelectRows(Source_Port, each [Name] = "msmdsrv.port.txt"), | |
#"Sorted Rows" = Table.Buffer(Table.Sort(msmdsrv,{{"Date created", Order.Descending}})), | |
Select_Last_Instance_Active = Table.FirstN(#"Sorted Rows",1), | |
#"Combined Binaries" = Binary.Combine(Select_Last_Instance_Active[Content]), | |
#"Imported Text" = Table.FromColumns({Lines.FromBinary(#"Combined Binaries",null,null,1252)}), |