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

Dealing with Column name changing

Hi everyone ! I have a big problem that is ruining my whole dashboard! I am pivoting some columns eg 201920 Q1, 201819 Q1 and then I create measures using these pivoted columns. Everytime I refresh the dasboard is breaking as the new column name is 201920 Q2 etc... Do you have something to suggest on how to deal with this problem?
3 REPLIES 3
edhans
Super User
Super User

You can refer to the columns by index number. For example, instead of 

= Table.RenameColumns(#"Changed Type",{{"month Arriving date", "test"}})

Which is normally what would happen if you clicked on column and renamed it, modfy it to use the following syntax:

 

= Table.RenameColumns(#"Changed Type", {{Table.ColumnNames(#"Changed Type"){2}, "test"}})

Basically instead of referring to the "month Arriving date" column by name, I am getting the name of the 3rd column (Power Query indexes by 0, so {2} is the 3rd column) and renaming it to "test"

 

 



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
danextian
Super User
Super User

 Hi @Ap674 ,

 

Please post a sample data (a link to google/one drive or dropbox).

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Mann
Resolver III
Resolver III

Hi @Ap674 

 

You need to handle dynamic column names in Power query before you do Pivoting. See this video for doing that.

https://www.youtube.com/watch?v=yBJr0sAc-m4

 

Mann.

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.