This file contains hidden or 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 | |
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], | |
AddIndex = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type), | |
Dupe = Table.DuplicateColumn(AddIndex, "Sentences", "Sentences2"), | |
SplitToRows1 = Table.ExpandListColumn(Table.TransformColumns(Dupe, {{"Sentences2", Splitter.SplitTextByDelimiter(" """, QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Sentences2"), | |
SplitToRows2 = Table.ExpandListColumn(Table.TransformColumns(SplitToRows1, {{"Sentences2", Splitter.SplitTextByDelimiter(""" ", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Sentences2"), | |
IdentifyAddlSplits = Table.AddColumn(SplitToRows2, "Custom", each [ | |
a = [Sentences], | |
b = Text.ToList( a ), | |
c = List.Select( b, each _ = """" ), |
This file contains hidden or 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 | |
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], | |
AddAttrib = Table.AddColumn(Source, "Attrib", each [ | |
a = {"A".."Z"}, | |
b = List.PositionOf( a, [Product Code]) + 1 | |
][b]), | |
Group = Table.Group(AddAttrib, {"Product Code"}, {{"All", each _, type table [Product Code=text, Ship Date=datetime, Po number=number, Po Quantity=number, Attrib=number]}}), | |
AddWGIndex = Table.RemoveColumns( Table.AddColumn(Group, "WithinGroupIndex", each Table.AddIndexColumn( [All], "WGIndex", 1, 1)), "All"), | |
Expand = Table.ExpandTableColumn(AddWGIndex, "WithinGroupIndex", {"Ship Date", "Po number", "Po Quantity", "Attrib", "WGIndex"}, {"Ship Date", "Po number", "Po Quantity", "Attrib", "WGIndex"}), | |
UnpivotOther = Table.UnpivotOtherColumns(Expand, {"Attrib", "WGIndex"}, "Attribute.1", "Value"), |
This file contains hidden or 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 | |
Source = {1..100000}, | |
Accumulate = | |
List.Accumulate( | |
Source, | |
"", | |
( state, current ) => state & ( if state = "" then "" else ", " ) & Text.From( current ) | |
), | |
SplitToList = List.Buffer( Text.Split(Accumulate, """, """)), |
This file contains hidden or 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 | |
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], | |
AddGlobalOrigOrder = Table.AddIndexColumn(Source, "GlobalOrigOrder", 0, 1, Int64.Type), | |
UnpivotOther = Table.UnpivotOtherColumns(AddGlobalOrigOrder, {"Group", "GlobalOrigOrder"}, "Attribute", "Value"), | |
SortNBuffer = Table.Buffer( Table.Sort(UnpivotOther,{{"Group", Order.Ascending}, {"Attribute", Order.Ascending}, {"GlobalOrigOrder", Order.Ascending}})), | |
Group = Table.Group(SortNBuffer, {"Group", "Attribute"}, {{"All", each _, type table [Group=number, GlobalOrigOrder=number, Attribute=text, Value=any]}}), | |
AddGlobalIdx1 = Table.AddColumn(Group, "GlobalIdx1", each Table.AddIndexColumn([All], "Global1", 1, 1)), | |
AddGlobalIdx0 = Table.SelectColumns( Table.AddColumn(AddGlobalIdx1, "GlobalIdx0", each Table.AddIndexColumn([GlobalIdx1], "Global0", 0, 1)), "GlobalIdx0"), | |
Expand = Table.ExpandTableColumn(AddGlobalIdx0, "GlobalIdx0", {"Group", "GlobalOrigOrder", "Attribute", "Value", "Global1", "Global0"}, {"Group", "GlobalOri |
This file contains hidden or 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
data <- dataset$Digits | |
find_n_digit_numbers_optimized <- function(n) { | |
start <- 10^(n-1) | |
end <- 10^n - 1 | |
valid_numbers <- numeric(0) | |
for (num in start:end) { | |
digit_sum <- sum(as.numeric(unlist(strsplit(as.character(num), "")))) |
This file contains hidden or 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 | |
String ="Amidst the ancient oak's shelter, the forest floor cradled fallen leaves. Leaves of gold, crimson, and russet danced in the autumn breeze. Breeze whispered secrets to the trees, and the trees listened, their branches swaying in rhythm. Rhythm of life echoed through the woodland—a symphony of rustling leaves and birdcalls. Birdcalls harmonized with the babbling brook, where water flowed over moss-covered stones. Stones, worn smooth by time, held stories of ages past. Past and present intertwined, as sunbeams filtered through the canopy, dappling the earth. Earth embraced memories, and memories lingered—a tapestry woven by seasons. Beneath the ancient oak, a squirrel gathered acorns, preparing for winter.", | |
Source = Web.BrowserContents("https://gist.github.com/ncalm/889ed38d780d653c4cce3d0df7f3d031"), | |
ExtractHTML = Html.Table(Source, {{"Column1", "TABLE.highlight.tab-size.js-file-line-container.js-code-nav-container.js-tagsearch-file > * > TR > :nth-child(1)"}, {"Column2", "TABLE.highli |
This file contains hidden or 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 | |
Source = DataRaw, | |
AddDupe = Table.DuplicateColumn(Source, "Entry", "EntryDupe"), | |
SpltToRowsByAPS = Table.ExpandListColumn(Table.TransformColumns(AddDupe, {{"EntryDupe", Splitter.SplitTextByDelimiter("APS ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "EntryDupe"), | |
FilterBlanks = Table.SelectRows(SpltToRowsByAPS, each ([EntryDupe] <> "")), | |
TrimEntryDuep = Table.TransformColumns(FilterBlanks,{{"EntryDupe", Text.Trim, type text}}), | |
SplitAmtByRSpace = Table.SplitColumn(TrimEntryDuep, "EntryDupe", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"EntryDupe.1", "Amount"}), | |
SplitDatebyRSpace = Table.RemoveColumns( Table.SplitColumn(SplitAmtByRSpace, "EntryDupe.1", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Deposit", "Date"}), "Entry"), | |
AddAPS = Table.TransformColumns(SplitDatebyRSpace,{{"Deposit", each Text.Insert(_ , 0, "APS "), type text}}), | |
SplitBySlash = Table.SplitColumn(T |
This file contains hidden or 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
RawData Query = | |
let | |
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LcvLDQAgDALQXXr2YD9qOkvj/mtooKcXAlRJTLmjxA7wACuTOjjaIyMK+hmLU3bebKDsotPnPg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Quantity = _t]), | |
ReType = Table.TransformColumnTypes(Source,{{"Quantity", Int64.Type}}), | |
AddIndex = Table.AddIndexColumn(ReType, "Index", 1, 1, Int64.Type) | |
in | |
AddIndex | |
Table Query |
This file contains hidden or 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 | |
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], | |
ToRecord = Table.CombineColumnsToRecord(Source, "Value", Table.ColumnNames(Source)), | |
ToTable = Table.TransformColumns(ToRecord, {"Value", each Record.ToTable(_)}), | |
AddOriginalRow = Table.AddIndexColumn(ToTable, "OriginalRow", 1, 1, Int64.Type), | |
Expand = Table.ExpandTableColumn(AddOriginalRow, "Value", {"Name", "Value"}, {"Name", "Values"}), | |
AddIsPopulated = Table.AddColumn(Expand, "IsPopulated", each if [Values] = null then 0 else 1), | |
AddIndex = Table.AddIndexColumn(AddIsPopulated, "Index", 0, 1, Int64.Type), | |
AddRunningTotal = Table.AddColumn(AddIndex, "RunningTotal", each List.Sum( List.FirstN( AddIndex[IsPopulated], [Index] + 1 ))), | |
AddRTPrevRow = Table.AddColumn(AddIndex, "RTPrevRow", each List.Sum( List.FirstN( AddIndex[IsPopulated], [Index] ))), |
This file contains hidden or 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 | |
Source = Table.DuplicateColumn( Excel.CurrentWorkbook(){[Name="Table1"]}[Content], "SA IDs", "ID"), | |
#"Sp;it1-6" = Table.SplitColumn(Source, "ID", Splitter.SplitTextByPositions({0, 6}, false), {"Date", "ID.2"}), | |
#"Split7-10" = Table.SplitColumn(#"Sp;it1-6", "ID.2", Splitter.SplitTextByPositions({0, 4}, false), {"SSSS", "ID.2.2"}), | |
Split11 = Table.SplitColumn(#"Split7-10", "ID.2.2", Splitter.SplitTextByPositions({0, 1}, false), {"Citizen", "ID.2.2.2"}), | |
Split12 = Table.SplitColumn(Split11, "ID.2.2.2", Splitter.SplitTextByPositions({0, 1}, false), {"Rand", "Checksum"}), | |
Split13 = Table.SplitColumn(Split12, "Date", Splitter.SplitTextByRepeatedLengths(2), {"Year", "Month", "Day"}), | |
TypeInt64 = Table.TransformColumnTypes(Split13,{{"Year", Int64.Type}, {"Month", Int64.Type}, {"Day", Int64.Type}, {"SSSS", Int64.Type}, {"Citizen", Int64.Type}, {"Rand", Int64.Type}, {"Checksum", Int64.Type}}), | |
AddtoYear = Table.TransformColumns(TypeInt64, {{"Year", each _ + 1900, type number}}), | |