cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Highlighted
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
Highlighted
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.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors