All guides

Refresh works on your laptop and fails in the Service

Local file paths, hardcoded servers and machine-specific settings inside Power Query, and how to make a model portable before publishing.

5 min read · updated 2026-09-21

What happens

The model refreshes fine in Power BI Desktop because the files are on your disk. Published to the Service, the gateway (or the cloud refresh) looks for C:\Users\you\Data\budget.xlsx on a machine where that path does not exist. The first scheduled refresh fails, the report keeps showing last week's numbers, and nobody is notified unless refresh alerts were configured.

The same applies to a SQL Server named by its short hostname, an ODBC DSN configured on one laptop, or a SharePoint path that includes a personal site.

How to find the offenders

Search the M code of every partition for File.Contents, Folder.Files, Csv.Document and Excel.Workbook with a drive letter, and for Sql.Database with a literal server name. In a PBIP project these are plain text in the .tmdl files under definition/tables, so a text search across the folder finds them in seconds. That is exactly what the static audit does, and it also masks the user name in the path before anything is shown or sent to the AI.

Making the model portable

Move every literal path and server into a Power Query parameter. Parameters can be changed in the Service without republishing and give you one place to switch between development and production sources.

Move Excel and CSV sources to SharePoint or OneDrive for Business and read them with SharePoint.Files or the Web connector. The refresh then needs no gateway at all.

Replace hand-typed tables (Enter data) that carry business rules, such as exclusion lists or mappings, with a real source someone else can edit. A DATATABLE inside the model is invisible to the business and impossible to update without a developer.

Parameterised source
let
    Source = Excel.Workbook(File.Contents(DataFolder & "\budget.xlsx"), null, true),
    Budget = Source{[Item = "Budget", Kind = "Sheet"]}[Data]
in
    Budget

What the audit checks

Local paths, literal endpoints, sources without parameters and hand-typed tables are each a separate check, so the finding tells you how many partitions to change and which ones. The corrected export can splice a rewritten M query back into the TMDL.

Detected by

Checks source-portability, source-endpoint-hardcoding, m-no-parameters-for-sources, m-enter-data-table among the 363 static checks, plus the AI review for the cases static analysis cannot prove.

Next: Time intelligence without a date table: the YoY that looks right and isn't