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

Working with Column Headers in Power Query

Hi,

 

When I work in Power Query on one of the sheets that I loaded from another excel workbooks I do some manipulation. 

 

Unpivot, Reorder and some other functions. In the end if someone will change one of the columns headers in my workbook all my work will be wasted since in my steps in power query when I checked, I saw that all the manipulation I did in Advance editor are using Column Names . 

 

Is there any other opthion to make the steps (re order, unpivot, etc.) withou using column name?

 

 

2 REPLIES 2
MarcelBeug
Community Champion
Community Champion

There are possibilities to adjust your queries in such a way that they will still work if columns are not the same each time.

 

But it requires some in-depth Power Query knowledge.

Gil Raviv blogged about a series of 10 pitfalls in Power BI / Power Query.
Several of those pitfalls are related to hard coded column names (especially from pitfall #4 and up).

 

Maybe you can use a solution I provided in another topic to rename columns by position.
So if you include such a rename in the beginning of your query/ies, then you can use that column names in the rest of your code.

As a prerequisite for this solution: the number of columns must not change.

 

Specializing in Power Query Formula Language (M)

Another cross post.

Specializing in Power Query Formula Language (M)

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.