Sub topic 7
Publishing and running the first refresh
This chapter covers what happens after you configure the refresh policy in Power BI Desktop: publishing the model, the first refresh in the Power BI service, and how later refreshes differ. It assumes you can already do the following:
- Create the
RangeStartandRangeEndparameters. - Filter a table with them so the filter folds to the source.
- Define a refresh policy with an archive period and an incremental period.
- Read the basics of partitions.
What Desktop does and does not do
The policy you define in Power BI Desktop is only metadata. Desktop does not create the partitions. It loads only the slice of data between the RangeStart and RangeEnd values you set in the parameters, and it keeps the policy as a property of the table.
The service creates the partitions. They appear only after you publish the model and a refresh runs. A .pbix file containing an incremental refresh table therefore has no history in it, only the development slice.
This has three consequences:
- The file you work on stays small and fast to open, even when the production table holds billions of rows.
- You cannot see the final partition layout in Desktop. To check it, use the service or the XMLA endpoint.
- The parameter values you set in Desktop do not decide which rows end up in the service. For each partition, the service substitutes its own
RangeStartandRangeEndvalues.
Before you publish
Check these points first. Each one is a common cause of a failed or very slow first refresh.
- The filter folds. In Power Query, right-click the filter step and confirm that View Native Query is available. If the option is greyed out, the filter does not fold, and every partition will read the whole table.
- The source credentials work from the service. For a cloud source, set the credentials in the dataset settings. For an on-premises source, you need a gateway with the data source registered.
- The workspace supports your plan. Incremental refresh works with Pro, Premium Per User, Premium capacity, and Fabric capacity. Hybrid tables and XMLA write operations need a Premium-type license.
- The model is finished. Republishing a model that has a refresh policy replaces the dataset, so you must refresh again to rebuild its partitions. Do not treat republishing as a cheap deployment step.
The sequence of events
The diagram shows what happens from publish to the first completed refresh.
Step 1: Publish
Publish from Desktop to a workspace on suitable capacity. The service adds the dataset with the policy attached. The table is empty at this point. If you open a report on it, you get no data until the first refresh finishes.
Step 2: Trigger the first refresh
You can start a refresh manually with Refresh now, or wait for a scheduled refresh. For the first run, trigger it manually and watch it. Then configure the schedule.
Step 3: Partition creation
When the refresh starts, the service reads the policy and the current date and builds the partitions. Using the settings from the Spine (keep five years, refresh the last ten days), the service creates:
- Day-level partitions for the incremental window (ten days).
- Coarser partitions for older data in the archive window, merged into larger units such as months, quarters, and years.
You can see partition names through the XMLA endpoint. They follow the period they cover:
| Granularity | Example name |
|---|---|
| Year | `2022` |
| Quarter | `2026Q3` |
| Month | `202611` |
| Day | `20261127` |
The exact grouping depends on the policy and on the date the first refresh runs. Do not hard-code assumptions about it in scripts. List the partitions and read the names instead.
Step 4: One query per partition
For every partition, the service evaluates your Power Query with that partition's boundaries in place of RangeStart and RangeEnd. If the filter folds, each partition produces a query like this one:
SELECT [OrderId], [OrderDate], [CustomerKey], [Amount]
FROM [dbo].[FactSales]
WHERE [OrderDate] >= '2026-11-18T00:00:00'
AND [OrderDate] < '2026-11-19T00:00:00';The first refresh is the expensive one because it loads every partition: the incremental window and the whole archive. It does the same total work as a full refresh would, plus the overhead of many queries.
First refresh versus later refreshes
| Aspect | First refresh | Later refreshes |
|---|---|---|
| Partitions created | All of them | Only new periods that have started |
| Partitions loaded | All, archive and incremental | Only those in the incremental window |
| Archive partitions | Loaded once | Left untouched |
| Partitions dropped | None | Those that fall out of the archive window |
| Typical duration | Long, comparable to a full load | Short, proportional to the window |
On each later refresh, the service moves the window forward by comparing the current date with the policy:
- New day partitions are created as time passes.
- Day partitions that leave the incremental window can be merged into coarser archive partitions.
- Archive partitions that are older than the retention period are dropped.
Rows in an archive partition are not re-read. If the source changes an old row, Power BI does not see the change until you refresh that partition explicitly. The chapter on detecting data changes covers a way to reduce this risk.
Timeouts and very large first loads
A single refresh operation has a time limit. It is about two hours for a dataset in shared capacity and about five hours in Premium capacity. A first refresh over many years of data can exceed that limit and fail. The usual workarounds, from simplest to most involved, are:
- Check query folding first. Without folding, the service runs one full table read per partition. This is the most common reason a first refresh is far slower than expected.
- Start with a shorter archive window. Publish with, for example, one year of history, refresh, then extend. Be aware that extending means changing the policy in Desktop and republishing, which replaces the dataset. Plan this step early, before users depend on the dataset.
- Load partitions in batches through the XMLA endpoint (Premium). Create the partitions with an empty initial processing step, then refresh them in groups with SQL Server Management Studio or a script.
The third approach uses a Tabular Model Scripting Language (TMSL) command, sent to the XMLA endpoint of the workspace. This command refreshes a single partition fully:
{
"refresh": {
"type": "full",
"objects": [
{
"database": "SalesModel",
"table": "FactSales",
"partition": "2022"
}
]
}
}The database value is the dataset name, and the partition value must match a name that exists in the service. Running one such command per year gives you several shorter operations that each fit inside the time limit.
Checking that the first refresh worked
After the refresh completes, confirm three things before you schedule it.
- Row counts and date range. In a report or with a DAX query, check the minimum and maximum of the date column. They should match the span of your archive plus incremental window.
- Refresh history. In the dataset's refresh history, look at the duration and the status. A first refresh that takes as long as an old full refresh is normal. A second refresh that does is a sign of a problem, usually broken query folding.
- Partition list. If you have Premium, connect with SSMS and expand the table's partitions. Check that the names and counts look right for your policy.
This DAX query returns the date range and row count in one result:
EVALUATE
ROW(
"MinDate", MIN(FactSales[OrderDate]),
"MaxDate", MAX(FactSales[OrderDate]),
"Rows", COUNTROWS(FactSales)
)Run the first refresh, then schedule a second one on another day or run it manually. Compare the two durations. The second should be much shorter. If it is not, go back to the folding check described at the start of this chapter.
Common first-refresh failures
| Symptom | Likely cause | What to do |
|---|---|---|
| Refresh fails with a credentials error | The service has no credentials for the source | Set credentials in dataset settings, or register the source on the gateway |
| Refresh times out | Many partitions or no folding | Verify folding, then load in batches through XMLA |
| Later refreshes are as slow as the first | Filter does not fold | Reorder or simplify steps so **View Native Query** is available |
| Table is empty after refresh | Date column values fall outside the window, or `RangeStart` and `RangeEnd` were filtered inconsistently | Check the data types and the boundary logic of the filter |
| History disappeared after a publish | A republish replaced the dataset | Refresh again, and avoid unplanned republishing |
Summary
Desktop holds only the policy and a development slice. The first refresh in the service builds the partitions and loads all of them, so it is the slowest. Later refreshes touch only the incremental window and move it forward. Check folding before you publish, and run the first refresh manually.
Exercise
You publish a model with a five-year archive and a ten-day incremental window. The first refresh takes three hours. The second refresh, a day later, also takes close to three hours. What is the most likely cause, and how do you confirm it?
Show answer
The filter on RangeStart and RangeEnd most likely does not fold, so every partition query reads the whole source table and filters it in the service. Confirm it by opening the table's query in Power Query and checking whether View Native Query is available on the filter step. If it is greyed out, change or reorder the steps so that the filter folds. A second refresh should only load the ten-day window, so a duration close to the first refresh points to the folding problem.
Exercise
A first refresh of a very large table fails because it exceeds the refresh time limit. Name two ways to get the history loaded, and one risk of each.
Show answer
One way is to publish with a shorter archive period and extend it later. The risk is that extending the period means republishing from Desktop, which replaces the dataset and requires another refresh. The other way is to refresh partitions in batches through the XMLA endpoint, for example with a TMSL refresh command per partition. The risk is that it needs a Premium-type license, and that editing or processing partitions by hand can conflict with the layout the service manages if you change more than the refresh.