Sub topic 14
Troubleshooting common connection and refresh errors
This chapter assumes you can build queries for Excel, CSV, and SharePoint sources in Power BI Desktop. It also assumes you know what applied steps, parameters, credentials, and privacy levels are, and that you have a basic idea of how the Power BI service refreshes a published semantic model. The goal is a repeatable way to find the cause of an error, plus a catalog of the errors you will meet most often with file-based sources.
A method for diagnosing errors
Most errors fall into one of three layers. Identify the layer first, because each layer has different fixes.
- Query layer. The M code fails when it runs. Examples are a missing column, a wrong type, or a file that cannot be parsed. The same error normally appears in Power BI Desktop.
- Access layer. The source is reachable in principle, but the credentials, privacy levels, or permissions are wrong.
- Service layer. The query works in Desktop but fails after publishing. The usual causes are a missing gateway, a local path that the service cannot see, or credentials that were never set or have expired.
A useful first test is to refresh in Power BI Desktop. If it fails there, work on the query layer or access layer. If it succeeds in Desktop and fails in the service, look at the service layer.
Query layer errors
The column of the table wasn't found
The message looks like Expression.Error: The column 'OrderDate' of the table wasn't found. A step refers to a column by name, and the source no longer has a column with exactly that name. Typical causes are a renamed header, a trailing space, a different letter case, or a promoted-header step that picked up the wrong row.
Check the step before the failing one in Power Query Editor and look at the actual column names. Then correct the name, or make the step tolerant of missing columns. Table.TransformColumnTypes accepts a culture argument, and several table functions accept MissingField.Ignore as a final argument:
let
Source = Csv.Document(File.Contents("C:\Data\orders.csv"), [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
Promoted = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
Selected = Table.SelectColumns(Promoted, {"OrderID", "OrderDate", "Amount"}, MissingField.UseNull)
in
SelectedMissingField.UseNull adds the column filled with nulls instead of failing. Use it only when a silent null is acceptable, because it can hide a real change in the source.
We couldn't convert to Number or Date
Type conversion errors usually appear as cell-level Error values, not as a failed query. The refresh can then succeed while rows show errors in the report. Common causes:
- A column contains text such as
N/Aor-among numbers. - Dates are written in a format that does not match the locale used for conversion, for example
03/04/2026read as March 4 or April 3. - Amounts use a comma as the decimal separator, but the conversion assumes a period.
Fix the locale by using Change Type > Using Locale in the editor, which writes a culture argument into the step. To find the offending rows, use Keep Errors on the column, or add a conditional step that replaces known placeholder text before the type change.
let
Source = Csv.Document(File.Contents("C:\Data\orders.csv"), [Delimiter = ";", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]),
Promoted = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
Cleaned = Table.ReplaceValue(Promoted, "N/A", null, Replacer.ReplaceValue, {"Amount"}),
Typed = Table.TransformColumnTypes(Cleaned, {{"OrderDate", type date}, {"Amount", type number}}, "de-DE")
in
TypedCSV loads as one column, or text looks garbled
If every row ends up in a single column, the delimiter is wrong. A semicolon-delimited file opened with Delimiter = "," behaves this way. Change the delimiter in the Csv.Document options.
If accented characters show as odd symbols, the encoding is wrong. Use Encoding = 65001 for UTF-8 and Encoding = 1252 for Windows Western European files. A byte order mark at the start of a file can also leave odd characters in the first header, which then causes the "column wasn't found" error above.
Excel: the table, sheet, or named range wasn't found
Excel.Workbook returns a navigation table with an Item and a Kind column. A lookup such as Source{[Item = "Sales", Kind = "Table"]} fails when someone renames the Excel table, or when the object changed kind. A sheet named Sales and a table named Sales are different rows, distinguished by Kind. Open the Source step and check which Item and Kind values now exist.
Reading from a sheet instead of a table also makes queries fragile. A sheet read returns the full used range, so extra notes or blank rows above the data break header promotion. An Excel table or a named range avoids this.
The file is in use, or the file can't be found
DataSource.Error: Could not find file means the path does not exist for the account running the query. The process cannot access the file because it is being used by another process happens with files locked by another program. Close the file, or read a copy. If the error occurs only after publishing, the path is not reachable from the service, which is covered below.
Access layer errors
Credentials and permissions
DataSource.Error: Access to the resource is forbidden or a 401 or 403 message points to the credentials. In Desktop, open Home > Transform data > Data source settings, select the source, and choose Edit Permissions or Clear Permissions. Clearing permissions forces a new sign-in on the next refresh.
For SharePoint Online, use the Organizational account option and sign in with an account that has at least read access to the site. A common mistake is to enter the full address of a file or a document library as the site URL. SharePoint.Files and SharePoint.Tables expect the site root, such as https://contoso.sharepoint.com/sites/Sales. Credentials are stored per URL, so an address with a different root gives a separate credential entry.
Formula.Firewall and privacy levels
The message begins Formula.Firewall: Query 'X' references other queries or steps, so it may not directly access a data source. Power Query blocks a query that combines data from two sources with different privacy levels, to avoid passing data from one source to another. It appears most often when a query uses a parameter to build a path and also reads a second source.
There are three typical remedies:
- Set the privacy level of each source in Data source settings. Use Organizational for company SharePoint and Private for sensitive local files.
- Split the logic into separate queries, each reading one source, and merge them in a later query.
- Ignore privacy levels only for your own Desktop file, through Options > Current File > Privacy. Avoid doing so for models that others will refresh, since it removes a protection.
Service layer errors
Local files and the gateway
A file at C:\Data\Sales.xlsx exists on your computer, not in the Power BI service. After publishing, a scheduled refresh fails with a message such as The credentials provided for the source are invalid or says that a gateway is required. Install an on-premises data gateway on a machine that can read the path, add the data source, and map the semantic model to it. The path in the model must match the path the gateway sees.
SharePoint Online files and lists do not need a gateway, because the service can reach them over the internet. They still need valid stored credentials.
Credentials missing or expired
After publishing, open the semantic model's Settings > Data source credentials. Each source shows as signed in or not. A new model often needs sign-in once. Tokens for an organizational account can also expire, for example after a password change or a conditional access policy. Sign in again and refresh.
Parameters and changed paths
If the query uses a parameter such as FolderPath, the service uses the value saved at publish time. Change it under Settings > Parameters in the service, not in Desktop. A parameter that changes the source path also changes which gateway data source is required, so check the mapping after you edit it.
let
Source = Csv.Document(File.Contents(FolderPath & "orders.csv"), [Delimiter = ",", Encoding = 65001]),
Promoted = Table.PromoteHeaders(Source, [PromoteAllScalars = true])
in
PromotedPower BI cannot always identify a data source whose path is built dynamically. If the service reports that the source cannot be refreshed because of a dynamic data source, rewrite the query so the path is built from a parameter in the same step, as above, rather than from another query's output.
Quick reference
| Symptom | Likely layer | First check |
|---|---|---|
| Column of the table wasn't found | Query | Column names in the step before the failure |
| Error values in a column after refresh | Query | Locale and placeholder text in the source |
| Everything in one column | Query | `Delimiter` in `Csv.Document` |
| Garbled characters | Query | `Encoding` value |
| Table or sheet not found in Excel | Query | `Item` and `Kind` in the `Source` step |
| Access forbidden or 401/403 | Access | Data source settings and site URL |
| Formula.Firewall | Access | Privacy levels, query structure |
| Works in Desktop, fails in service with local path | Service | Gateway and data source mapping |
| Fails on schedule after weeks | Service | Expired credentials |
Working habits that prevent errors
- Read from named Excel tables rather than sheets.
- Keep one source per query, and merge in a later query.
- Store paths and site URLs in parameters.
- Check Refresh history in the service. It records the time and the error text of each run.
- Change one thing at a time and refresh after each change, so you know which change fixed it.
Exercise
A report refreshes without problems in Power BI Desktop. After publishing, the scheduled refresh fails. The query reads C:\Data\orders.csv through a FolderPath parameter. Name the layer where the fault most likely lies and two things you must set up.
Show answer
The fault is in the service layer. The service cannot read a path on your computer. Install an on-premises data gateway on a machine that can read the path, then add the data source to the gateway and map the semantic model to it, entering valid credentials. After any change to the FolderPath parameter, check that the gateway data source still matches the new path.
Exercise
A CSV refresh shows Expression.Error: The column 'OrderDate' of the table wasn't found. The file looks fine when you open it in a text editor. Give two likely causes.
Show answer
The header text may differ from the name in the step, for example through a renamed column, a trailing space, or a different letter case. A byte order mark or a wrong delimiter or encoding can also change the first header name, or put the whole row in one column. Inspect the step before the failing one to see the actual column names.