Sub topic 9
Configuring scheduled refresh
A published semantic model keeps the data that was in your .pbix file when you published it. Scheduled refresh tells the Power BI service to reload that data on a timetable, so the report stays current without anyone opening Power BI Desktop. This chapter covers setting up a schedule, what limits apply, and how to diagnose failures.
This chapter assumes you have already published a report to a workspace and set data source credentials. The previous chapter covers credentials and gateways. You also need to be able to open the semantic model's settings page in the service.
What scheduled refresh does
Refresh applies to semantic models that use Import mode. In Import mode, Power BI copies data from the source into the model. A refresh runs your Power Query queries again, replaces the stored data, and recalculates the model.
Other storage modes behave differently:
| Storage mode | Stores a copy of the data | Scheduled refresh |
|---|---|---|
| Import | Yes | Reloads the stored data on your schedule |
| DirectQuery | No | Not needed for data. A separate schedule refreshes cached visuals |
| Live connection | No | Not available. The report reads from the remote model |
The refresh always runs in the service, using the credentials stored with the semantic model. It does not use your Desktop sign-in or the files on your laptop. If a query reads C:\Data\sales.xlsx, the service cannot reach it unless an on-premises data gateway has access to that path.
Open the refresh settings
- Go to the workspace and find the semantic model. It has a different icon from the report.
- Open the More options menu (the three dots) and choose Settings.
- Expand the Refresh section. Older layouts name it Scheduled refresh.
The settings page also holds Data source credentials and Gateway connection. If either shows a warning, fix it first. Refresh cannot succeed without working credentials.
Create a schedule
In the Refresh section:
- Turn Configure a refresh schedule on.
- Choose a Refresh frequency: Daily or Weekly. With Weekly, select the days.
- Choose a Time zone. Pick the zone your users think in, because the schedule follows that zone's clock changes.
- Select Add another time for each additional run. Set the time for each.
- Under failure notifications, keep Send refresh failure notifications to the semantic model owner selected. Add contacts if a team should be told as well.
- Select Apply.
The service may start a refresh a little after the time you set. Do not rely on a run beginning at an exact minute. If a downstream process needs the data by a given time, schedule the refresh well before it.
Frequency limits
The number of scheduled refreshes per day depends on the capacity that hosts the workspace.
| Capacity type | Scheduled refreshes per day | Time slots |
|---|---|---|
| Shared capacity (Pro or Premium Per User workspace) | Up to 8 | Spread across the day |
| Dedicated capacity (Premium or Fabric) | Up to 48 | Every 30 minutes |
These limits count scheduled refreshes. A Refresh now run from the menu is separate. Limits can change, so check current Microsoft documentation if you are planning close to the maximum.
Refreshes also have a time limit. On shared capacity, a refresh that runs longer than 2 hours is stopped and counts as a failure. Dedicated capacity allows up to 5 hours. If your model is close to the limit, consider reducing the data loaded or using incremental refresh, described later.
Who owns the schedule
A semantic model has one owner, normally the person who first published it. Scheduled refreshes run with the data source credentials the owner configured. This has consequences:
- If the owner leaves the organization or their account is disabled, refreshes can start failing.
- If someone else republishes a .pbix with the same name, the owner does not change, but you should confirm the credentials still apply.
- To change the owner, use Take over on the semantic model settings page. You then sign in to the data sources again, because credentials belong to the owner.
For models that matter, have more than one person who can take over, and consider a service account for the data sources.
What happens during a refresh
The following diagram shows how a scheduled run proceeds and where it can stop.
Refresh is all or nothing. If one query fails, the model keeps its previous data. Users never see a half-updated model, but they may see stale data until the problem is fixed.
Check refresh history
Refresh history is the first place to look when numbers seem old.
- In the workspace, open the semantic model's More options menu.
- Choose Refresh history. You can also reach it from Settings.
- Review the Scheduled and On demand tabs.
Each row shows a start time, an end time, a status, and for failures an error message with a Show link for details. A failed row usually names the source, the error code, and a request ID. Keep the request ID if you need to contact support.
Run a refresh now
Refresh now starts an on-demand refresh using the same credentials. Use it after you set up a schedule, to confirm the whole path works before you wait for the first scheduled time. It is also the quickest way to retest after fixing a credential error.
When refreshes are turned off for you
Power BI pauses schedules automatically in two cases:
- Consecutive failures. After four failures in a row, the service disables the schedule and sends a notification. Fix the cause, then turn the schedule back on.
- Inactivity. If nobody opens a report or dashboard built on the semantic model for two months, the service pauses scheduled refresh to save resources. Opening the report again lets you re-enable it.
Common failures and fixes
| Symptom in history | Likely cause | Fix |
|---|---|---|
| Credentials are invalid or expired | A password changed, or an OAuth token expired | Edit the data source credentials in settings and sign in again |
| Gateway is offline or unreachable | The gateway machine is off, or the service is stopped | Restart the gateway service and check its status |
| Cannot find the file or table | A path or table name changed at the source | Update the query in Desktop and republish |
| Timeout after 2 hours | Model is too large for shared capacity, or the source is slow | Filter data, move to dedicated capacity, or use incremental refresh |
| Data source is not mapped to a gateway | A new source was added in Desktop | Map the source to a gateway data source in settings |
| Dynamic data source cannot be refreshed | The M query builds a URL at run time | Use `RelativePath` and `Query` options with a static base URL |
The last row catches many people. The service must see a fixed data source address when it analyzes the query. If a Web request is built by concatenating strings, refresh can fail even though it works in Desktop.
Reduce load with incremental refresh
By default, every refresh reloads all rows. Incremental refresh keeps older data as is and reloads only a recent window. You define it in Desktop with two Power Query parameters named RangeStart and RangeEnd. Then you set a policy on the table, for example "store 5 years, refresh the last 7 days." The policy takes effect after you publish and the first refresh runs.
Use incremental refresh when:
- A table is large and most rows never change.
- Full refreshes approach the time limit.
- The source supports query folding, so the date filter runs at the source.
Without folding, Power BI would read the whole table and filter afterward, which removes most of the benefit.
Automate refresh with PowerShell
You can also manage schedules and trigger refreshes from scripts. This is useful after an automated deployment, which the final chapter covers. The script below sets a weekday schedule for a semantic model and starts one refresh. It uses the MicrosoftPowerBIMgmt module and calls the REST API through Invoke-PowerBIRestMethod.
Connect-PowerBIServiceAccount
$ws = Get-PowerBIWorkspace -Name 'Sales Analytics'
$ds = Get-PowerBIDataset -Workspace $ws -Name 'Sales'
$schedule = @{
value = @{
enabled = $true
days = @('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday')
times = @('06:00', '12:00', '18:00')
localTimeZoneId = 'UTC'
notifyOption = 'MailOnFailure'
}
} | ConvertTo-Json -Depth 4
Invoke-PowerBIRestMethod -Method Patch `
-Url "groups/$($ws.Id)/datasets/$($ds.Id)/refreshSchedule" `
-Body $schedule `
-ContentType 'application/json'
# Start one refresh now
Invoke-PowerBIRestMethod -Method Post `
-Url "groups/$($ws.Id)/datasets/$($ds.Id)/refreshes" `
-Body '{"notifyOption":"MailOnFailure"}' `
-ContentType 'application/json'
# Read the last five entries from refresh history
Invoke-PowerBIRestMethod -Method Get `
-Url "groups/$($ws.Id)/datasets/$($ds.Id)/refreshes?`$top=5" |
ConvertFrom-Json |
Select-Object -ExpandProperty value |
Select-Object status, startTime, endTimeA few points about this script:
- The account that runs it must be able to change the semantic model, and it must be the owner or have taken over, as described earlier.
- On shared capacity, times must be on the hour or half hour, and you can list at most 8.
- The refresh request returns right away. The refresh runs in the background, so poll the history to see the result.
- The API has its own daily limit for refresh requests on shared capacity, in addition to the schedule.
Checklist before you rely on a schedule
- Confirm the semantic model uses Import mode.
- Confirm data source credentials show as valid, and a gateway is mapped where needed.
- Run Refresh now and read the entry in refresh history.
- Set the schedule, time zone, and notification contacts.
- Check history again after the first scheduled run.
- Note who can take over ownership if the current owner is unavailable.
Exercise
A semantic model on a Pro workspace refreshes at 06:00, 09:00, 12:00, 15:00, 18:00, 21:00, 00:00, 03:00, and a ninth time at 04:30. The service will not let you add the ninth time. Why, and what are two ways to get more frequent updates?
Show answer
Shared capacity allows at most 8 scheduled refreshes per day, so a ninth is rejected. You can move the workspace to dedicated capacity (Premium or Fabric), which allows up to 48 per day, or you can trigger extra refreshes from a script through the REST API, keeping in mind that API refreshes have their own daily limit on shared capacity. Reducing how often the data really needs updating is a third option.
Exercise
Your scheduled refresh worked for months, then stopped. History shows four failed runs with a credentials error, and the schedule toggle is now off. List the steps to recover.
Show answer
First fix the cause: open the semantic model settings, edit the data source credentials, and sign in again. If the owner left, use Take over first. Then run Refresh now and confirm it shows Completed in refresh history. Finally, turn the schedule back on, because four consecutive failures disabled it, and check history after the next scheduled run.
Exercise
A report works in Desktop, but the service refresh fails with a message that the data source cannot be refreshed. The query reads a CSV from C:\Reports\input.csv. What is wrong, and what options do you have?
Show answer
The service cannot reach a path on your local computer. Either install an on-premises data gateway on a machine that can read that path and map the source to it, or move the file to a cloud location such as SharePoint or OneDrive for Business and point the query there.