– CAN YOU SOLVE THIS - POWER QUERY CHALLENGE 1 —
Extract the numeric digits from the given strings in a column and sum the digits for those extracted strings in another column.
I think I started doing these challenges about a week after they started in August 2022, so I’m going back and doing the ones I didn’t do the first time through…
let
Source = Excel.CurrentWorkbook(){[Name=“Table1”]}[Content],
ExtractDigits = Table.AddColumn(Source, “Digits”, each Text.Select( Text.From( [String] ), {“0”…“9”})),
SumDigits = Table.AddColumn(ExtractDigits, “Sum of Digits”, each [
a = Text.ToList( [Digits] ),
b = List.Transform( a, Number.From),
c = List.Sum( b )
][c])
in
SumDigits
Yeah, List.Generate is more powerful and intuitive. I typically only List.Accumulate for simple accumulations rather than more advanced recursive logic.