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

Unpivoting, and then working with pivoted and unpivoted tables

Hello,

 

I am trying to turn the following table:

DateLineFront1Front2Front3Front4Front5Front7
1/1/191010000

1/1/19

2011000
2/1/191000001

 

Into the following:

DateLineValueData
1/1/191Front10
1/1/191Front21
1/1/191Front30
.........

...

1/1/192Front10
............
2/1/191Front10
............

 

I have tried unpivoting but I cannot make it work. Any suggestions?

 

After that, I also need to work still with the original table because there's a few extra columns that I am interested to keep in that format. Is it possible?

 

Thank you very much.

2 ACCEPTED SOLUTIONS
helassal
Resolver II
Resolver II

Hi @Anonymous ,

 

Unpivoting should work, please try the following:

1- First, create a reference from your base query in Power Query:

PowerBI_Unpivot1.jpg

Now, you have the base query and a new query referencing the first query.

 

2- In the new query, select columns you wish to unpivot then right click and press "Unpivot only selected columns":

PowerBI_Unpivot2.jpg

 

Now you should have the base query which can be used normally in the report and you have the 2nd query which references the first one and then unpivots the needed columns.

 

Sample Power BI file

 

Hope this helps.

 

 

 

View solution in original post

v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Click on column [Front1], [Front2], [Front3], [Front4], [Front5] and [Front7] and then click Unpivot, after that you will achieve two columns [attribute] and [value], rename them to [Value] and [Data].

Capture.PNG 

2.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Click on column [Front1], [Front2], [Front3], [Front4], [Front5] and [Front7] and then click Unpivot, after that you will achieve two columns [attribute] and [value], rename them to [Value] and [Data].

Capture.PNG 

2.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

helassal
Resolver II
Resolver II

Hi @Anonymous ,

 

Unpivoting should work, please try the following:

1- First, create a reference from your base query in Power Query:

PowerBI_Unpivot1.jpg

Now, you have the base query and a new query referencing the first query.

 

2- In the new query, select columns you wish to unpivot then right click and press "Unpivot only selected columns":

PowerBI_Unpivot2.jpg

 

Now you should have the base query which can be used normally in the report and you have the 2nd query which references the first one and then unpivots the needed columns.

 

Sample Power BI file

 

Hope this helps.

 

 

 

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.