Forum Discussion
jamuka
1 year agoHelper IV
Filterering Columns with Dynamic Names
Hello all, I have table with product and store information. I transform this table to another table, first grouped based on Product Type, then pivoted it. Then I filtered Product Type Z1 where o...
jamuka
1 year agoHelper IV
Hi slorin,
thank you for your help, your code works but if a product have two different store it didn't combine stores and
didn't show it in final table.
Current Table
| Product | Store | Product Type |
| 2 | X1 | Z1 |
| 2 | X2 | Z1 |
Updated Table
| Product | Z1 |
| 2 | X1 - X2 |
my current (hard coded) formula is
let
Source = YourSource
#"Grouped Rows" = Table.Group(#"Source", {"Product", "Product Type"}, {{"Table", each Text.Combine([Store],"-"), type nullable text}}),
#"Pivoted Column" = Table.Pivot(#"Grouped Rows", List.Distinct(#"Grouped Rows"[#"Product Type"]), "Product Type", "Table"),
#"Filtered Rows" = Table.SelectRows(#"Pivoted Column", each ([Z1] <> null) and ([Z2] = null) and ([Z3] = null) and ([Z4] = null) and ([Z5] = null) and ([Z7] = null))
in
#"Filtered Rows"
kind regards
Cem