If you want to be able to specify which column, I'd create a function for that that takes a table and column name as arguments - something like:
Code:
let
SumTableColumn = (t as table, columnName as text) as number =>
let
TempSource = Table.TransformColumnTypes(t,{{columnName, type number}}),
Result = List.Sum(Table.Column(TempSource, columnName))
in
Result,
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMU9JRciwoyEktBjIMDZRidWCi/kWJeelgYWMTJGH3osQCsKipKVjULTUJ2QhjZFGEEWYGSMJwI6CKfROLkjOQDTExQBFHGGOKKoEwCCgeCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, Product = _t, Sales = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", type text}, {"Product", type text}, {"Sales", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Month"}, {{"Count", each _, type table [Month=nullable text, Product=nullable text, Sales=nullable number]}}),
#"Added Custom2" = Table.AddColumn(#"Grouped Rows", "SQLrowcount", each Table.RowCount([Count])),
#"Added Custom" = Table.AddColumn(#"Added Custom2", "Custom", each [Count][Sales]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each SumTableColumn([Count], "Sales") as number),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom1",{{"Custom", "ToList"}, {"Custom.1", "Totals"}})
in
#"Renamed Columns"
Bookmarks