Created
November 26, 2023 05:57
-
-
Save bjulius/06ff2bffd3efe71b9798349001ce763e to your computer and use it in GitHub Desktop.
Crispo Excel Challenge 11/25/2023 - Brian Julius Solution
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], | |
RemoveLetters = Table.AddColumn(Source, "Custom", each Text.Remove([Visits Tracker], {"A".."z","-"})), | |
Trim = Table.TransformColumns(RemoveLetters,{{"Custom", Text.Trim, type text}}), | |
SplitSpacetoRows = Table.ExpandListColumn(Table.TransformColumns(Trim, {{"Custom", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Custom"), | |
Filter = Table.SelectRows(SplitSpacetoRows, each ([Custom] <> "")), | |
SplitSlashtoRows = Table.ExpandListColumn(Table.TransformColumns(Filter, {{"Custom", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Custom"), | |
ReType = Table.TransformColumnTypes(SplitSlashtoRows,{{"Custom", Int64.Type}}), | |
Add0Index = Table.AddIndexColumn(ReType, "Index", 0, 1, Int64.Type), | |
Modulo2 = Table.AddColumn(Add0Index, "Modulo", each Number.Mod([Index], 2), type number), | |
ChgSign = Table.AddColumn(Modulo2, "Value", each if [Modulo] = 0 then -1 * [Custom] else [Custom]), | |
Group = Table.Group(ChgSign, {"Visits Tracker"}, {{"Remaining Visits", each List.Max([Remaining Visits]), Int64.Type}, {"Answer", each List.Sum([Value]), Int64.Type}}) | |
in | |
Group |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment