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
radomzal
New Member

Unpivoting Variable Number of Columns

Hello,

 

My dataset is an Excel file that is generated by a very inflexible program.  In order to make functional tables, I need to unpivot the columns.  My problem is that the number of columns in the Excel file changes every time the file is generated.

 

My data looks like this:

Date | Property | Product 1 | Product 2 | Product 3 .......

 

When I unpivot the Product columns the formula is:

= Table.Unpivot(#"Changed Type", {"Product 1", "Product 2", "Product 3", .... }

 

How can I change the function to unpivot all columns from column #3 up to (and including) the last column?

 

Thanks!

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@radomzal you can select the first two columns Date and Property, then Unpivot Other Columns.

edhans_0-1600466063325.png

It doesn't matter if there is 1 or 100 other columns, they will all get unpivoted.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

@radomzal you can select the first two columns Date and Property, then Unpivot Other Columns.

edhans_0-1600466063325.png

It doesn't matter if there is 1 or 100 other columns, they will all get unpivoted.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

I can't believe I missed noticing that was an option!  Thanks!

Glad to help @radomzal  - I'd say 95% of the time I use the Unpivot Other Columns feature vs the Unpivot Columns feature. 😁



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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