Power BI: dashboard stops to work after the column name has been changed

When the column name of my data source has changed, my dashboard will stop to work and to resolve it, I will have to update it manually. In this article, I will explain different ways to do it automatically and I will have to do it in Power BI Query. I have this data source:

excel Power BI
power bi power bi

If in excel, I change the name of the column A from “ticket” to “number”, I will get an error after the refresh:

power bi

Based on the configuration of my data source, I may be able to use option 1, if not, option 2.

Option 1: without coding

On the right side, in “applied steps”, I will delete the 2 last steps:

power bi power bi

If the result doesn’t look like that, go to option 2:

power bi

Click on “home -> remove rows -> remove top rows” then put 1 because I want to delete only the first row:

power bi
power bi

Double click on the header to change the name:

power bi power bi

So in the excel, I can put whatever I want, in Power BI, it will always be “incident”. The negative part for this option is that when I add a new column in excel, in Power BI, I will have to change the name manually if not, it will appear as “column 3”.

Option 2: with coding

I will have to modify the code by implementing: Table.ColumnNames(xxx){0}

NOTE:

  • Change xxx by the previous step name
  • 0 means column A so 1 = column B, etc.

Click on “home -> advanced editor”:

power bi

Change the green part by the code above:

power bi
power bi

NOTE: do that for every column that the name can be changed

So in the excel, the name that I will put, it will be reflected to Power BI and I don’t have the negative part of the unique name.

power bi

If I want to have an unique name, meaning that putting whatever I want in excel, in Power BI, it will always be “incident” for instance

Click on “home -> use first row as headers -> use headers as first row”:

power bi

Click on “home -> remove rows -> remove top rows” then put 1 because I want to delete only the first row:

power bi
power bi

Double click on the header to change the name:

power bi power bi

Click on “home -> advanced editor”:

power bi

Change the green part by the code above:

power bi
power bi

NOTE: do that for every column that the name can be changed

The negative part for this unique name is that when I add a new column in excel, in Power BI, I will have to change the name manually if not, it will appear as “column 3”.

Interesting Topics