Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lennox25
Helper V
Helper V

Convert multiple row data into columns

I have tried and failed to use Pivot Columns in Power Query for this. Basically I need to Pivot the Category with the Outcome (not aggregated) Is there a DAX formula I can use for this. Below is as the data is in Power BI.

lennox25_0-1697800320776.png

and below is how I want it to appear. Please note there are 100s of  Store numbers./thousands of rows.

lennox25_1-1697800410473.png

 

1 ACCEPTED SOLUTION
mickey64
Super User
Super User

For your reference.

 

Step 0: I use these data.

DATA:

Date Store No Category Outcome Name Visit Type Job Title Store Size
02/10/2023 4567 1a Good Mickey Mouse Visit Manager Small
02/10/2023 4567 1b Satisfactory Mickey Mouse Visit Manager Small
02/10/2023 4567 1c Improvement Necessary Mickey Mouse Visit Manager Small
02/10/2023 4567 1d Not Checked Mickey Mouse Visit Manager Small
02/10/2023 4567 2 Good Mickey Mouse Visit Manager Small
02/10/2023 4567 3 Good Mickey Mouse Visit Manager Small
02/10/2023 4567 4 Good Mickey Mouse Visit Manager Small
08/10/2023 2345 1a Satisfactory Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1b Improvement Necessary Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1c Not Checked Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1d Good Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 2 Good Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 3 Satisfactory Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 4 Improvement Necessary Donald Duck Desk visit Senior Manager Large

 

Step 1: I add 7 conditional columns.

    mickey64_7-1697807502213.png

    mickey64_0-1697807278961.png

    mickey64_1-1697807313332.png

    mickey64_2-1697807342740.png

    mickey64_3-1697807369900.png

    mickey64_4-1697807399131.png

    mickey64_5-1697807429918.png

    mickey64_6-1697807458034.png

    mickey64_8-1697807569528.png

 

Step 2: I fill down these 7 columns.

    mickey64_9-1697807644521.png

 

Step 3: I filter 'Category' column by '4'.

    mickey64_10-1697807739373.png

    mickey64_11-1697807820852.png

 

Step 4: I remove 'Category' column and 'Outcome' column.

    mickey64_12-1697807903254.png

    mickey64_13-1697807983262.png

 

View solution in original post

3 REPLIES 3
Anand24
Super User
Super User

Hi @lennox25 ,
If you simply want the grid/table in your screen to be this way, Why not simply use Matrix visualization and put "Category" field in columns?

 

If you need the data in this structure itself, you can unpivot from Power Query Editor.

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

 

mickey64
Super User
Super User

For your reference.

 

Step 0: I use these data.

DATA:

Date Store No Category Outcome Name Visit Type Job Title Store Size
02/10/2023 4567 1a Good Mickey Mouse Visit Manager Small
02/10/2023 4567 1b Satisfactory Mickey Mouse Visit Manager Small
02/10/2023 4567 1c Improvement Necessary Mickey Mouse Visit Manager Small
02/10/2023 4567 1d Not Checked Mickey Mouse Visit Manager Small
02/10/2023 4567 2 Good Mickey Mouse Visit Manager Small
02/10/2023 4567 3 Good Mickey Mouse Visit Manager Small
02/10/2023 4567 4 Good Mickey Mouse Visit Manager Small
08/10/2023 2345 1a Satisfactory Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1b Improvement Necessary Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1c Not Checked Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 1d Good Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 2 Good Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 3 Satisfactory Donald Duck Desk visit Senior Manager Large
08/10/2023 2345 4 Improvement Necessary Donald Duck Desk visit Senior Manager Large

 

Step 1: I add 7 conditional columns.

    mickey64_7-1697807502213.png

    mickey64_0-1697807278961.png

    mickey64_1-1697807313332.png

    mickey64_2-1697807342740.png

    mickey64_3-1697807369900.png

    mickey64_4-1697807399131.png

    mickey64_5-1697807429918.png

    mickey64_6-1697807458034.png

    mickey64_8-1697807569528.png

 

Step 2: I fill down these 7 columns.

    mickey64_9-1697807644521.png

 

Step 3: I filter 'Category' column by '4'.

    mickey64_10-1697807739373.png

    mickey64_11-1697807820852.png

 

Step 4: I remove 'Category' column and 'Outcome' column.

    mickey64_12-1697807903254.png

    mickey64_13-1697807983262.png

 

Thank you so much! Perfect Solution 🙂

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.