Forum Discussion
Yamabushi
1 year agoHelper I
Finding count of possible combinations
Hi, I have a table that looks something like this: Person Criteria 1 Criteria 2 Criteria 3 A 1 0 1 B 1 1 0 C 0 1 0 D 0 1 0 E 1 1 0 F 0 0 1 I need...
- 1 year ago
Hi Yamabushi
let
Source = YourSource,
Unpivot = Table.UnpivotOtherColumns(Source, {"Person"}, "Criteria1", "Value"),
Join = Table.NestedJoin(Unpivot, {"Person"}, Unpivot, {"Person"}, "Unpivot", JoinKind.LeftOuter),
Expand = Table.ExpandTableColumn(Join, "Unpivot", {"Criteria1", "Value"}, {"Criteria2", "Value2"}),
Product = Table.AddColumn(Expand, "Product", each [Value] * [Value2], type number),
Group = Table.Group(Product, {"Criteria1", "Criteria2"}, {{"Count", each List.Sum([Product]), Int64.Type}})
in
GroupStéphane
ChielFaber
1 year agoSuper User
If I'm interpreting your question the right way you can just use the group by function in the UI.
let
Source = PUTYOURSOURCEHERE,
#"Grouped Rows" = Table.Group(Source, {"Criteria 1", "Criteria 2", "Criteria 3"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
#"Grouped Rows"