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
BiBra
Helper III
Helper III

post unpivot - new columns

This is a bit hard to describe, however I will give it a shot. I have an excel sheet supplying data to my report. the same data is used for two queries in the report. Each of the tables have different columns unpivoted. When the excel sheet is updated, new columns for both tables are added, and these need to be unpivoted as well. I know how to do it manually, however, I would like for the report to manually adding these to the unpivoted columns in each of the tables. 

 

I have considered both the unpivot(""); and UnpivotOtherColumns(""); However both are insufficient, because I do not know the names of the new added columns beforehand. Is there any way to make power BI automatically do this automatically?

8 REPLIES 8
RM_1
Frequent Visitor

Do you found a solution? I have the same issue.

ImkeF
Super User
Super User

With unpivot others all new columns will be unpivoted automatically. How does that differ from your requirement?

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

@ImkeF as described - I cannot use either of these because I have two tables that originate from the same source. Some of the new columns belong to table 1(and should be pivoted here) and the other columns belong to table 2(and should be pivoted here). Therefore it is not possible to simply use unpivot or unpivot others.

Hi @BiBra,

I'm having difficulties to understand your requirement. Could you please give an example of your 2 tables and the desired output please? Thx.

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

@ImkeF

table of origin:

 

name, product1-a, product2-a, product1-v, product2-v

 

table 1(after pivot):

name, product1-v, product2-v, attribute, value

 

table2(after pivot):

name, product1-a, product2-a, attribute, value

 

 

 

Then when a new product is added, the following two columns are added - product3-a and product3-v.

I want them to be automatically unpivoted in table 1 and 2.

@BiBra

Sorry, I'm giving up here, as I still cannot see why unpivot others wouldn't work.

Hopefully someone else sees what I can't.

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

@ImkeF if I have a new product, it produces two columns product3-a and product3-v to the origin table. If I use unpivot others, both of the new columns will be unpivoted in each of the tables. Whereas the tables are supposed to unpivot one each

@BiBra,

sorry, but as I said, I'm out here.

Hopefully someone else picks this up.

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