Forum Discussion
Anonymous
3 years agoNot applicable
Inclue Total in a Table
Hello, I need make a Line with the total in a table, for example: I have this table that I insert in power query: Category Count1 Count2 A 1 1 B 2 1 C 3 1 D 4 1 ...
- 3 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIE41idaCUnIMsIznMGsozhPBcgywTOcwWyTOE8NyDLDM5zB7LMIbxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, Count1 = _t, Count2 = _t]), ChangeType = Table.TransformColumnTypes(Source,{{"Category", type text}, {"Count1", Int64.Type}, {"Count2", Int64.Type}}), Total = {"Total", List.Sum(ChangeType[Count1]), List.Sum(ChangeType[Count2])}, Result = Table.FromRows(Table.ToRows(ChangeType) & {Total}, Table.ColumnNames(ChangeType)) in Result
jgordon11
3 years agoResolver II
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIE41idaCUnIMsIznMGsozhPBcgywTOcwWyTOE8NyDLDM5zB7LMIbxYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Category = _t, Count1 = _t, Count2 = _t]),
ChangeType = Table.TransformColumnTypes(Source,{{"Category", type text}, {"Count1", Int64.Type}, {"Count2", Int64.Type}}),
Total = {"Total", List.Sum(ChangeType[Count1]), List.Sum(ChangeType[Count2])},
Result = Table.FromRows(Table.ToRows(ChangeType) & {Total}, Table.ColumnNames(ChangeType))
in
Result- Anonymous3 years agoNot applicable