Forum Discussion
scampbll
4 years agoNew Member
Need to compare rows of tables dynamically
I'm trying to compare information from two reports. This involves 20-30 categories for up to 800 people. Both aspects are dynamic, but the categories are more easily pinned down than the people. ...
- 4 years ago
If anyone else is trying to do something like this, here's the code from the point that I got all my data into a standardized table (the source) to the point that I aggregated the data for each category and person. I'm still totally open to suggestions for better ways.
#"Data Columns" = List.Skip(Table.ColumnNames(Source)), #"Changed to Number" = Table.TransformColumnTypes(Source, List.Transform(#"Data Columns", each {_, type number})), #"Replaced Nulls" = Table.ReplaceValue(#"Changed to Number", null, 0, Replacer.ReplaceValue, #"Data Columns"), #"Inserted Text After Delimiter" = Table.AddColumn(#"Replaced Nulls", "Type", each Text.AfterDelimiter([Temp Column], ": "), type text), #"Extract DP1" = Table.TransformColumns(Table.SelectRows(#"Inserted Text After Delimiter", each ([Type] = "DP1")), List.Transform(#"Data Columns", each {_, each _*-1})), #"Extract DP2" = Table.SelectRows(#"Inserted Text After Delimiter", each [Type] = "DP2"), #"Re-combine" = Table.Combine({#"Extract DP1", #"Extract DP2"}), #"Inserted Text Before Delimiter" = Table.AddColumn(#"Re-combine", "Category", each Text.BeforeDelimiter([Temp Column], ":"), type text), #"Removed Columns" = Table.RemoveColumns(#"Inserted Text Before Delimiter", {"Temp Column", "Type"}), #"Grouped Rows" = Table.Group(#"Removed Columns", {"Category"}, {{"Group by Category", each _, type table}}), #"Aggregated Columns" = Table.AggregateTableColumn(#"Grouped Rows", "Group by Category", List.Transform(#"Data Columns", each {_, List.Sum, _})), ...
HotChilli
Community Champion
4 years agoPlease post some sample data (not pictures) and show the desired result