Sub topic 5
Defining the refresh policy: archive and incremental periods
This chapter assumes you can already create the RangeStart and RangeEnd parameters and filter a table with them so the filter folds to the source. Those steps come first because the refresh policy cannot be saved without them. Here you will define the policy itself: how much history to keep, and how much of it to reload on each refresh.
What the policy controls
A refresh policy is a set of rules stored on one table in the model. It answers two questions.
- How far back should the table keep data? This is the archive period, also called the rolling window.
- How much of that data should be reloaded on every refresh? This is the incremental refresh period.
Data older than the incremental period but still inside the rolling window is kept as it was loaded. It is not read from the source again. Data older than the rolling window is dropped.
Each setting has two parts: a number and a granularity (day, month, quarter or year). "5 years" and "10 days" are two such settings.
Setting the policy in Power BI Desktop
You define the policy in the Desktop dialog. The steps are:
- In the Data pane or Model view, right-click the table and choose Incremental refresh.
- Turn on Set import and refresh ranges. If the toggle is unavailable, the table is missing a valid
RangeStartandRangeEndfilter. Fix the query first. - Under Archive data starting, enter a number and choose a granularity. This is the rolling window.
- Under Incrementally refresh data starting, enter a number and choose a granularity. This is the incremental period.
- Optionally turn on Detect data changes and Only refresh complete periods. Both are covered in later chapters.
- Select Apply.
Applying the policy does not load or partition anything in Desktop. Desktop keeps loading only the RangeStart to RangeEnd slice you set in the parameters. The policy takes effect when you publish and refresh in the service.
How the two periods relate
Both periods are measured backward from the refresh date. Suppose today is 27 November 2026, the archive period is 5 years and the incremental period is 10 days.
- The incremental period covers the last 10 days up to today.
- The archive period covers the 5 years before the incremental period begins, counted in whole calendar units of the archive granularity.
The incremental period sits inside the rolling window. It is not added to it. A policy of "5 years archived, 10 days refreshed" keeps five years in total, and only the newest ten days of those are reloaded.
The JSON below is the same policy as it appears in the model metadata (the TMSL or TOM refreshPolicy object). It is useful to know because you will see it in tools that read the model definition.
{
"refreshPolicy": {
"policyType": "basic",
"rollingWindowGranularity": "year",
"rollingWindowPeriods": 5,
"incrementalGranularity": "day",
"incrementalPeriods": 10
}
}The mapping to the dialog is direct. rollingWindowPeriods and rollingWindowGranularity are the archive setting. incrementalPeriods and incrementalGranularity are the incremental setting.
Choosing the incremental period
The incremental period must be long enough to cover every row that can still change, and no longer. Ask what the latest date is on which a source row can be inserted or modified.
| Situation | Reasonable incremental period |
|---|---|
| Rows are appended once and never edited | 1 to 3 days. A few days of margin covers a failed or delayed refresh. |
| Orders can be corrected or cancelled for up to 30 days | 1 month |
| Late-arriving data is posted into past dates, such as end-of-month adjustments | At least the longest delay, rounded up to the granularity |
| Finance restates the previous quarter | 1 quarter |
If the period is too short, edits to older rows never reach the model. The data silently drifts from the source. If it is too long, you reload more than you need and lose part of the benefit.
A second rule matters here. A change made to a row in the archive period is not picked up by normal refreshes. Only a full reload of that partition, for example through the XMLA endpoint, corrects it.
Choosing the granularity
The granularity of each setting decides the size of the partitions the service creates. A later chapter covers partitions in detail, but the choice affects the policy now.
- Day granularity for the incremental period produces many small partitions. This suits a short window such as 10 days.
- Month, quarter or year granularity produces fewer, larger partitions.
- The archive granularity can be coarser than the incremental granularity. A common pattern is years for the archive and days for the incremental period.
Longer incremental periods at a fine granularity create many partitions, and each refresh runs a query per partition. A 5-year archive in days with no coarser level would mean about 1,800 partitions. Choosing a coarser archive granularity avoids that.
Rules the dialog enforces
The dialog checks the settings before it lets you apply them.
- The incremental period must be shorter than the archive period.
- The incremental granularity cannot be coarser than the archive granularity.
- The table must be filtered on
RangeStartandRangeEndusing a Date/Time column. - Only one date column per table is used, and it must not change after rows are loaded, such as a "last modified" column used as the partition key. Use a column that stays fixed for a row, such as the order date.
If a validation message appears, it is almost always about one of these. A warning about query folding is also common. It means Power BI could not confirm that the filter folds to the source. Do not dismiss it, because without folding each partition reads the whole table and then filters it in memory, and the policy gives you no savings.
A worked example
You have a FactSales table with 600 million rows from 2019 on. Sales are appended daily. Returns can adjust rows for the previous 14 days. Reports need five years of history.
The policy:
- Archive data starting 5 years before the refresh date.
- Incrementally refresh data starting 14 days before the refresh date.
The query from the previous chapter already contains the folding filter:
let
Source = Sql.Database("myserver.database.windows.net", "SalesDb"),
FactSales = Source{[Schema = "dbo", Item = "FactSales"]}[Data],
Filtered = Table.SelectRows(
FactSales,
each [OrderDate] >= RangeStart and [OrderDate] < RangeEnd
)
in
FilteredThe filter uses >= on one boundary and < on the other. This means a row on the boundary belongs to exactly one partition, so nothing is counted twice or dropped.
After the first refresh in the service, the model holds five years of data. Each later daily refresh reads about 14 days from the source, which is a few hundred thousand rows rather than hundreds of millions. Partitions that age out of the window are removed, and new ones are added as time passes.
Common mistakes
- Treating the periods as additive. The incremental period is inside the rolling window. Setting 5 years plus 10 days does not give you 5 years and 10 days of history on top of each other.
- Using a modified-date column as the filter. A row that moves from one date to another can appear in two partitions or none. Partition on a date that never changes for a row.
- Setting the incremental period shorter than the correction window. Corrections beyond it are never loaded.
- Ignoring the folding warning. The policy applies, but every refresh still scans the whole source table for each partition.
- Expecting Desktop to partition. Desktop keeps the small development slice. The partitions appear only after publishing and refreshing in the service.
- Editing the policy after publishing and republishing with a full refresh expected. If you change the policy and republish, the service applies it on the next refresh and may rebuild partitions. Plan for a long first refresh after any change that alters the window.
Summary of the decisions
| Decision | Question to ask | Effect of a wrong answer |
|---|---|---|
| Archive period | How much history do users need? | Too short loses history. Too long increases model size and first-refresh time. |
| Incremental period | How far back can a row still change? | Too short leaves stale data. Too long reloads more than needed. |
| Granularity | How many partitions do I want to manage? | Too fine gives many partitions and many queries per refresh. |
| Date column | Does the value stay fixed for a row? | A changing value can duplicate or lose rows. |
Exercise
A table has a policy of 3 years archive and 1 month incremental. Orders can be corrected for up to 45 days after they are placed. What goes wrong, and what is the smallest change that fixes it?
Show answer
Corrections made between 1 and 1.5 months after the order date fall in the archive period, which normal refreshes do not re-read. Those rows stay out of date in the model. The smallest fix is to set the incremental period to 2 months (or 45 days) so that every row that can still change is reloaded. The archive period can stay at 3 years because the incremental period remains shorter than it.
Exercise
Your colleague sets the incremental refresh period to 10 days and the archive period to 5 years, then says the model will hold "5 years and 10 days" of data. Is this correct?
Show answer
No. The incremental period lies inside the rolling window. The model holds 5 years in total, and only the most recent 10 days of those are reloaded on each refresh.