cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Martin-Prague Regular Visitor
Regular Visitor

Data Shaping - Pivot

Hello Experts,

 

I need to perform following pivot operation in Power Query.

I need to Group the data by Sales Rep and Date/Date and then the rest of the fields should be pivoted as in the following example.

Would you advise me how to it in Power Query?

Power BI Pivot.JPG

 

Thanks a lot,

Martin

1 ACCEPTED SOLUTION

Accepted Solutions
Super User I
Super User I

Re: Data Shaping - Pivot

#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Added Prefix", {"Rep", "Day", "Place"}, "Attribute", "Value"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Columns",{"Place", "Attribute"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Merged"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[Merged]), "Merged", "Value")
in
    #"Pivoted Column"

These three steps will generate the output.

View solution in original post

2 REPLIES 2
Super User I
Super User I

Re: Data Shaping - Pivot

#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Added Prefix", {"Rep", "Day", "Place"}, "Attribute", "Value"),
    #"Merged Columns" = Table.CombineColumns(#"Unpivoted Columns",{"Place", "Attribute"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Merged"),
    #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[Merged]), "Merged", "Value")
in
    #"Pivoted Column"

These three steps will generate the output.

View solution in original post

Martin-Prague Regular Visitor
Regular Visitor

Re: Data Shaping - Pivot

Amazing!

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors