I have a table in Powerquery (simplified version of my actual table) where I have a product a bomline and a BOMproduct.
Product | Bomline | Bomproduct |
---|---|---|
A | 1 | 1.1 |
A | 2 | 1.2 |
A | 3 | 1.3 |
My desired end result of the table would be the following table, do you have any Idea how to accoplish that in PowerQuery? I'm thinking of storing a list of all combinations, but don't know where to start.
Product | Bomline | Bomproduct | All_combinations |
---|---|---|---|
A | 1 | 1.1 | 1.1 |
A | 2 | 1.2 | 1.2 |
A | 3 | 1.3 | 1.3 |
A | 1 | 1.1 | 1.3 |
A | 2 | 1.2 | 1.1 |
A | 3 | 1.3 | 1.2 |
A | 1 | 1.1 | 1.2 |
A | 2 | 1.2 | 1.3 |
A | 3 | 1.3 | 1.1 |
This is a simple Cartesian product. If your table looks like this:
Add a custom column and write the name of your previous step (mine is called Changed Type).
Then expand the relevant column:
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Bomline", Int64.Type}, {"Bomproduct", type number}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each #"Changed Type"),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Bomproduct"}, {"Bomproduct.1"})
in
#"Expanded Custom"