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
OneWithQuestion
Post Prodigy
Post Prodigy

Unpivot column into NEW table?

I have 6 columns I need to unpivot into a new table.

 

I cannot seem to figure out how to do this in Power BI Desktop.

 

I can unpivot, but then it duplicates all the rows of my existing table as I don't want to make the existing table change.

 

Is there a way to select columns and unpivot them into a NEW table (and specify a FKID to go with them from the original table)?

 

Is there an M language command I can use to generate a new table and populate it with the results of an "unpivot"?

4 REPLIES 4
Greg_Deckler
Super User
Super User

Generally you would create a new query, perhaps a copy of the old query, remove all of the other columns and then unpivot. Tought to say exactly without actual data and example of what you are trying to achieve. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Also, @ImkeF might be able to decipher what you are trying to do.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks.

 

In this case I am pulling data in from an SPO list and it takes a few minutes for the data to load.

 

I'd hate to have to re-query that same source a second time.

 

Is there anyway to use DAX or M query language to make an in memory table or calculated table?

 

The table looks like this:

 

PKID, Issue Title, Source1, Source2, Source3, other_columns

 

I would like to unpivot just Source1, 2, and 3, bring the PKID with them into the new table.  Additionally, I want to leave the original table unchanged.

You might look at doing this in DAX. You could create a new table using something like SUMMARIZE perhaps. Tough to say without an example of the data involved and expected result.

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Greg is right: If you want to be sure that the data isn't loaded again, you should use DAX.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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.

Top Solution Authors
Top Kudoed Authors