Skip to content

Instantly share code, notes, and snippets.

@Softwaretrain
Created September 12, 2022 06:14
Show Gist options
  • Save Softwaretrain/5d6dabbc67e4fe9ca459580b45818188 to your computer and use it in GitHub Desktop.
Save Softwaretrain/5d6dabbc67e4fe9ca459580b45818188 to your computer and use it in GitHub Desktop.
Solution to Excel BI Excel/Power Query Challenge 19
let
Source=Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
CustomColumn = Table.AddColumn(Source, "Answer", each let
Spl=Text.Split([Sentence]," "),
lenSpl=List.Transform(Spl,each Text.Length(_)),
addlen=List.Zip({Spl,lenSpl}),
tbl=#table({"Sentence","length"},addlen),
filter=Table.SelectRows(tbl,
let max = List.Max(tbl[length])
in each
[length] = max)[[Sentence]][Sentence],
combine=Text.Combine(filter,", "),
proper=Text.Proper(combine)
in proper)
in
CustomColumn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment