Forum Discussion

OneWithQuestion's avatar
OneWithQuestion
Post Prodigy
7 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    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.

    • OneWithQuestion's avatar
      OneWithQuestion
      Post Prodigy

      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.