powerquery - Arranging Data in a Query Table -
i'm trying figure out simple way (using powerquery) convert this:
into this:
i've spent days trying figure out simple way it.
everything i've tried has failed.
you can use group on transform tab, group project , define aggregation each of segment columns (e.g. sum). adjust created code list.sum list.removenulls. add column nested tables segment columns, using table.fromcolumns. remove original segment columns , expand nested tables.
let source = excel.currentworkbook(){[name="table1"]}[content], #"changed type" = table.transformcolumntypes(source,{{"project", type text}, {"segment1", type text}, {"segment2", type text}, {"segment3", type text}}), #"grouped rows" = table.group(#"changed type", {"project"}, {{"segment1", each list.removenulls([segment1]), type text}, {"segment2", each list.removenulls([segment2]), type text}, {"segment3", each list.removenulls([segment3]), type text}}), #"added custom" = table.addcolumn(#"grouped rows", "tabled", each table.fromcolumns({[segment1],[segment2],[segment3]},{"segment1","segment2","segment3"})), #"removed columns" = table.removecolumns(#"added custom",{"segment1", "segment2", "segment3"}), #"expanded tabled" = table.expandtablecolumn(#"removed columns", "tabled", {"segment1", "segment2", "segment3"}, {"segment1", "segment2", "segment3"}) in #"expanded tabled" 

Comments
Post a Comment