Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
metoda_technik
Frequent Visitor

Adding a column to a csv file stored on Amazon Athena s3 leads to refresh errors

Hi,

I connected Power BI to a csv file stored on Amazon Athena s3 using an on-premise data gateway. This works fine until I add a new column to the csv file. I can see the new column in PowerBI desktop's data preview, but if I reference it in the query definition I get an error:

Table.RenameColumns(#"Promoted Headers",{{"country", "Country"}})

Expression.Error: The column 'country' of the table wasn't found. Details: country

If I add a row to the table though, it wants me to provide a value for the new column:

Table.InsertRows(#"Promoted Headers", 0,{[id = 0, Product Name = "my product"]})

Expression.Error: The field 'country' of the record wasn't found.

 

The only workaround I found so far is to upload the csv file to s3 with a different name, then everything works as intended. But I have hundreds of files having the same issue and I'm not the only one using these files, so this is not an option.

Any ideas what could cause these issue?

6 REPLIES 6
V-yubandi-msft
Community Support
Community Support

Hi @metoda_technik ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

V-yubandi-msft
Community Support
Community Support

Hi @metoda_technik ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

V-yubandi-msft
Community Support
Community Support

Hi @metoda_technik ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

MFelix
Super User
Super User

Hi @metoda_technik ,

 

Check if in the first step of the Power Query you have a parameter called columns add one additional number to that. 

In the example below I have 3 I should change to 4 to get an additional column.

MFelix_0-1742402373017.png

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

there is no columns parameter in my query. The column 'country' is available when I use Table.InsertRows (I have to specify a value for 'country' or get an error message), I can see it in the data preview, but when I want to rename it or filter by it I get the 'column not found' error.

Hi @metoda_technik ,

Thank you for confirming there's no Columns= parameter. Based on your description, it appears to be a schema inference or metadata caching issue in Power Query.

 

Although the country column is visible in the preview, some transformation steps (like RenameColumns) might still depend on outdated metadata, especially when using CSV files via Athena.

Here are a few suggestions:

1. Use Table.PromoteHeaders to ensure the latest headers are applied.

2. Remove the Columns=3 parameter from Csv.Document this limits schema detection.

3. Use Table.ColumnNames() to inspect what Power Query is actually seeing.

3.  Move any renaming or filtering steps after header promotion and type inference.

 

You can review the attached official Microsoft documentation for further clarification.

Here’s the official Csv.Document documentation 

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.