Sub topic 16
Incremental refresh for large tables
This chapter assumes you can already build a Power Query query in Power BI Desktop, publish a dataset, and configure a scheduled refresh as covered earlier. It also assumes you know the refresh limits and timeouts for your license.
Why a full refresh stops scaling
A normal scheduled refresh reloads every row of every imported table. That is fine for small tables. For a fact table with hundreds of millions of rows, a full reload can run into the refresh timeout. It also loads the gateway and the source database with data that has not changed.
Incremental refresh splits a table into partitions by date. Old partitions are kept as they are. Only the recent partitions are reloaded.
The two parameters
Incremental refresh depends on two Power Query parameters with reserved names, RangeStart and RangeEnd. Both must be of type Date/Time. Desktop uses them to cut the table into time slices. You never set their values in the service.
Filter a date column with them in your query:
let
Source = Sql.Database("sql01.contoso.local", "Sales"),
Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data],
Filtered = Table.SelectRows(
Orders,
each [OrderDate] >= RangeStart and [OrderDate] < RangeEnd
)
in
FilteredUse >= on one boundary and < on the other. If both boundaries are inclusive, a row that falls exactly on a boundary lands in two partitions and is counted twice.
Defining the policy
In Desktop, right-click the table, choose Incremental refresh, and set two periods:
- Store rows in the last: how much history to keep, for example 5 years.
- Refresh rows in the last: how much recent data to reload each time, for example 10 days.
Publish the dataset. The first refresh in the service builds all partitions and loads the full history, so it takes as long as a full refresh would. Later scheduled refreshes reload only the recent window, and partitions that age out of the history are dropped.
Query folding is what makes it fast
The date filter must fold, which means Power Query translates it into a WHERE clause that the source database runs. If folding breaks, the gateway pulls the whole table and filters it afterwards. Each partition then costs a full read, and refresh gets slower than before.
To check, right-click the filter step in Power Query and look for View Native Query. If the option is greyed out, the step does not fold. Move the date filter earlier in the query, before steps that break folding.
Common errors
| Symptom | Likely cause |
|---|---|
| Policy option is unavailable | `RangeStart` or `RangeEnd` is missing, misspelled, or not Date/Time |
| First refresh times out | Full history load exceeds the limit, or the filter does not fold |
| Duplicate rows | Both filter boundaries are inclusive |
| Old changes never appear | Edited rows are older than the refresh window |
The last row is a design limit. Rows changed outside the refresh window are not picked up, so choose a window that covers how late your source can change data.
Exercise
A sales table has an OrderDate column, and the policy stores 3 years and refreshes the last 7 days. A correction is made to an order dated 30 days ago. Will the next scheduled refresh show it, and why?
Show answer
No. The order sits in a partition older than the 7-day refresh window, so that partition is not reloaded. To pick up the correction you need a longer refresh window, or a full refresh of that partition.