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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Pivot or Unpivot table to separate columns

Hi all,

 

How is it that you pivot or unpivot columns?  so far i've succeded with trial and error, but for some reason i cant figure out how to transform this data properly.

 

Im looking to have units and revenue in separate columns.

Right now units and revenue is in same column with "number" indicating the value of either units or revenue.

 

cap2.PNG

1 ACCEPTED SOLUTION
Maddy99
Resolver II
Resolver II

PowerBI has a button that could help you easy.

1) go to query editor.

2) select the 2 columns (number and atribute) for you
step 1.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3) click on "Pivot" in the transform menu.

4) choose "number" as your value. 

you can choose the default sum or do not aggegrate as an option. but the default would work to. step 2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

i hope this would work for you.

View solution in original post

6 REPLIES 6
Maddy99
Resolver II
Resolver II

PowerBI has a button that could help you easy.

1) go to query editor.

2) select the 2 columns (number and atribute) for you
step 1.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3) click on "Pivot" in the transform menu.

4) choose "number" as your value. 

you can choose the default sum or do not aggegrate as an option. but the default would work to. step 2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

i hope this would work for you.

Anonymous
Not applicable

Hi @Maddy99

 

One follow up question. Now that i units and revenue in their own column, i have duplicate independent categories. 

For example:

 

I have not only "product" and "country" in my real file, there I have like 8 unique categories/segments (don't know the right word for independent item). But i would like to only have 1 unique item and  then revenue and units on the same row, as shown in below picture. 


Can that be done?

 

cap6.PNG

 

 

 

is the caused by the pivot action?

can you set in the advanced editor the aggegration value to sum? this may help.

i was not able to recreate this problem . so i am not sure it this would work. because you have the 0 vales in your table

 

or you can do a goup. 

group all the other columns execpt revenue en unit. 

1) select all the other columns

2) click on group by

3) make to aggegrations with a sum. 1 for revenue and 1 for unit.

group by.PNG

 

 

Anonymous
Not applicable

Sorry, that was a mistake.

 

I dont have the value 0 ,  it is just empty field, like this:

 

cap8.PNG

can that not be just the case?

for that specifick row there is not revenue available? 

in your print screen i dont see a row wich have both, a unit and a revenue. or the date or the product are always differnt.

 

 

Anonymous
Not applicable

thanks a lot for your answer.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.