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
smpa01 Senior Member
Senior Member

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
smpa01 Senior Member
Senior Member

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
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 230 members 2,428 guests
Please welcome our newest community members: