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 = | |
(function as function) => | |
let | |
function_ = function, | |
Metadata = (functionType) as record => | |
let | |
Help = Value.Metadata(if functionType is type then functionType else Value.Type(functionType)) | |
in | |
Help, |
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
(Filename as text) => | |
let | |
// Unz-function from: https://querypower.com/2017/03/22/extracting-power-queries-in-m/ | |
Unz = (binaryZip,fileName) => | |
let | |
//shorthand | |
UInt32 = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger32,ByteOrder.LittleEndian), | |
UInt16 = BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16,ByteOrder.LittleEndian), |
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 = | |
(InputText as text, StartDelimiter as text, EndDelimiter as text, optional Alternative_Dummy as text) => | |
let | |
// If the end delimiter contains the same characters than the start delimiter then that portion has to be replaced in the end parameter by a dummy. Otherwise the query fails. | |
AlternativeDummy = Alternative_Dummy, | |
Dummy = if AlternativeDummy is null then "*+*" else AlternativeDummy, | |
String = InputText, | |
ParaStart = StartDelimiter, | |
ParaEnd = EndDelimiter, |
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) => | |
let | |
/* Debug parameters | |
Table = #"Price Paid", | |
SortColumn = "Date", | |
AmountColumn = "Price paid", | |
*/ |
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 = | |
(List as list) => | |
let | |
List = List.Buffer(List), | |
LA = | |
List.Accumulate( | |
List.Skip(List), | |
[Table = Table.FromColumns({List}), Counter = 2], |
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 = | |
(PeriodStartForecast as number, PeriodEndForecast as number, OriginalForecast as table) => | |
let | |
/* Debug Parameters | |
PeriodEndForecast = PeriodEndForecast, | |
PeriodStartForecast = PeriodStartForecast, | |
OriginalForecast = LU_Original_Forecast_Data, | |
*/ |
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
// Exports the current table to csv. Pass full PathFile specification as parameter | |
(path as text, dataset as table) => | |
let | |
ConvertedPath = Text.Replace(path, "\", "/"), | |
RScript = R.Execute("write.csv(dataset,"""&ConvertedPath&""") | |
output <- dataset | |
",[dataset=dataset]), | |
output = RScript{[Name="output"]}[Value] | |
in | |
output |
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
// splits text where every character before the last character is a number | |
// matching string will be the first item of the new text, but that can be modified by filling up instead | |
let | |
Source = "Appl2e Pe3ar Banan2a Toma4to Potato", | |
ToList = Text.Split(Source, " "), | |
#"Converted to Table" = Table.FromColumns({ToList}), | |
PatternCheck = Table.AddColumn(#"Converted to Table", | |
"Pattern", | |
each if List.Contains({"0".."9"}, Text.At([Column1], Text.Length([Column1])-2)) | |
then [Column1] |