Sub topic 7
Publishing and running the first refresh
This chapter assumes you have already created the RangeStart and RangeEnd parameters, filtered the large table with them, and configured a refresh policy in Power BI Desktop. It covers what changes when you publish the model and how the first refresh in the Power BI service differs from every later one.
What Desktop does and does not do
Power BI Desktop never creates the partitions. It stores the refresh policy in the model metadata, and it loads only the rows between RangeStart and RangeEnd. That is why your local file stays small.
The policy below is the excerpt from the previous chapter. It is what the service reads after you publish.
{
"refreshPolicy": {
"policyType": "basic",
"rollingWindowGranularity": "year",
"rollingWindowPeriods": 5,
"incrementalGranularity": "day",
"incrementalPeriods": 10
}
}Publishing copies the model and the policy to the workspace. The table is still empty of history at that point. Nothing loads until a refresh runs.
Publishing steps
- In Power BI Desktop, select Publish and choose the target workspace.
- In the service, open the semantic model's settings and set the data source credentials. For an on-premises source, bind the model to a gateway first.
- Start a refresh with Refresh now, or wait for the scheduled refresh.
A refresh fails with a credentials error if step 2 is skipped. Fix the credentials and run it again.
What the first refresh does
On the first refresh, the service reads the policy and builds the partitions. It then loads every partition in the window. For the policy above, that means five years of history plus the recent days. The service substitutes real boundary values for RangeStart and RangeEnd in each partition's query, so each partition reads only its own slice.
The first refresh is therefore the most expensive one. It loads roughly as much data as a full refresh would, and sometimes takes longer because of the partition overhead. Later refreshes are cheap.
| Aspect | First refresh | Later refreshes |
|---|---|---|
| Partitions created | Yes, all of them | Only new ones as time passes |
| Data loaded | The whole window | The incremental period only |
| Archive partitions | Loaded once | Left untouched |
| Duration | Longest | Short |
The diagram shows the order of events.
Why the first refresh can fail
The first refresh is where most setups break. Three causes are common:
- Time limit. A refresh in shared capacity stops after two hours. In Premium capacity the limit is five hours. A large history can exceed it.
- Memory. Loading many partitions at once needs memory for the data and for the refresh work itself.
- Query folding is broken. If the filter does not fold, every partition query scans the whole table, and the first refresh multiplies that cost by the number of partitions.
For very large histories, Premium capacity lets you process partitions in batches through the XMLA endpoint. A later chapter covers that option. You can also shorten the first load by temporarily setting a smaller archive period, publishing, refreshing, and then widening the policy. Check the result before you rely on it, because changing the policy and republishing changes the partition layout.
Republishing
Publishing again from Desktop replaces the model in the service, including its partitions. The next refresh is then a first refresh again, with the full cost. Avoid republishing the model for small report changes. Edit the report in the service, or keep the report in a separate file connected to the published model.
Quick check after the first refresh
Open the model's refresh history and confirm the status is Completed. Then check that the data reaches back as far as the archive period. A card showing MIN of the date column is enough for a first look. A later chapter covers deeper checks against the source.
Exercise
You publish a model whose policy keeps five years of data and refreshes the last ten days. The first refresh takes three hours. A colleague republishes the file the next day to fix a report title, and the next refresh is slow again. Why, and what should they do instead?
Show answer
Republishing replaces the model and its partitions, so the next refresh is a first refresh that loads the whole five-year window again. They should change the title by editing the report in the service, or keep the report in a separate file connected to the published model, so the model is not republished.