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
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
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
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 59 members 1,164 guests
Please welcome our newest community members: