Sub topic 6
How the policy becomes partitions
This chapter assumes you can already create the RangeStart and RangeEnd parameters, filter a table with them so the filter folds, and set a refresh policy in Power BI Desktop. It explains what the Power BI service builds from that policy after you publish, because most refresh behavior follows from the partition layout.
From policy to partitions
A refresh policy is a rule stored with the table. It does not load any data. The service reads the rule and splits the table into partitions the first time it processes the published model.
A partition is a slice of a table that the engine can process on its own. Every Import table has at least one. Without a policy, that one partition holds the whole table, so a refresh reloads all of it. With a policy, the table has many partitions, and a refresh touches only some of them.
The service sorts the partitions into three groups.
- Archive partitions hold older data inside the rolling window. They are loaded once and then left alone.
- Incremental partitions cover the incremental refresh period. They are reloaded on every refresh.
- Real-time partition is a DirectQuery partition for data after the refresh date. It exists only if you enable hybrid tables, which a later chapter covers.
The incremental group sits at the recent end of the window, and the archive group holds everything older, up to the start of the window.
The example policy
The JSON below is the policy from the earlier chapter. It keeps five years of data and refreshes the last ten days.
{
"refreshPolicy": {
"policyType": "basic",
"rollingWindowGranularity": "year",
"rollingWindowPeriods": 5,
"incrementalGranularity": "day",
"incrementalPeriods": 10
}
}Two settings define the layout:
- The rolling window (
rollingWindowGranularityandrollingWindowPeriods) sets how far back the table keeps data. Here that is five years. - The incremental window (
incrementalGranularityandincrementalPeriods) sets how much recent data is reloaded each time. Here that is ten days.
The incremental window must be shorter than the rolling window. The incremental window is part of the rolling window, not an addition to it.
How the service chooses partition sizes
The service does not create one partition per day for five years. It makes partitions of different sizes, using coarser ones for older data.
For the example policy, the refresh date is the day the refresh runs. The service builds:
- Day partitions for the last ten days, because the incremental granularity is a day.
- Month partitions for the earlier part of the current year, because month is the next granularity above day. This applies when the incremental period is in days and the window is in years.
- Year partitions for the full earlier years in the window.
When you refresh, the service merges day partitions into month partitions and month partitions into year partitions as they age out of the finer groups. This keeps the partition count low. A five-year window with ten incremental days produces tens of partitions, not nearly two thousand.
The exact layout depends on the two granularities you chose. The table summarizes the usual pattern.
| Incremental granularity | Archive partitions are built from |
|---|---|
| Day | Days, then months, then years |
| Month | Months, then years |
| Quarter | Quarters, then years |
| Year | Years |
Treat this as the general pattern, not as a guarantee. Microsoft can change how the service groups partitions, so rely on the behavior rather than on a fixed partition count.
How partitions get their rows
Each partition has its own query. The service takes your Power Query query and substitutes the partition's date boundaries for RangeStart and RangeEnd.
Consider the filter from the earlier chapter.
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
FilteredIn Desktop, the parameters hold the development values, such as 1 January 2020 to 1 February 2020. In the service, each partition runs this query with its own boundaries. A day partition for 20 November sets RangeStart to 20 November 00:00 and RangeEnd to 21 November 00:00. A year partition sets the boundaries to the start and end of that year.
Because the filter uses >= on one end and < on the other, a row at exactly midnight on a boundary belongs to one partition only. If you used >= on both ends, that row would load twice and your totals would be wrong.
If the filter folds, each partition sends a WHERE clause to the source and gets back only its slice. If it does not fold, each partition may read the whole table and filter it in the mashup engine. The data in the model is still correct, but you lose the benefit of the policy and the refresh can be slower than before.
What a refresh does to each group
After the first refresh, later refreshes follow the same pattern.
- The service computes the current refresh date and works out which partitions the policy requires.
- It creates any new partitions that the passing of time requires, such as a new day partition for today.
- It removes partitions that have fallen outside the rolling window, such as the oldest year once it is more than five years old.
- It reloads the partitions in the incremental window.
- It leaves the archive partitions as they are, unless you changed the policy or ran a full refresh.
The diagram shows how a daily refresh moves the boundary forward.
Because the dropping step happens on refresh, data past the window does not disappear until a refresh runs. If scheduled refresh fails for a week, old data stays in the model for that week.
An example of the partition layout
Suppose the policy above runs on 27 November 2026. The service builds roughly this layout.
| Partition | Covers | Group |
|---|---|---|
| 2021 | 1 January 2021 to 31 December 2021 | Archive |
| 2022 | The year 2022 | Archive |
| 2023 | The year 2023 | Archive |
| 2024 | The year 2024 | Archive |
| 2025 | The year 2025 | Archive |
| 2026-01 to 2026-10 | Each month from January to October 2026 | Archive |
| 2026-11 | November 2026, up to the start of the incremental window | Archive |
| Days 18 to 27 November | Ten day partitions | Incremental |
The exact boundaries differ in the real service, and the window starts relative to the refresh date, so a small piece of 2021 may fall outside the window. The point is the shape: a few large old partitions, a run of monthly ones, and a short tail of daily ones.
When the incremental window needs a refresh, only the ten day partitions reload. The roughly 60 rows-heavy years and months before them are not queried at all.
Partition boundaries and time zones
The boundaries use the date of the refresh in UTC. The service evaluates the policy against the refresh date, not against your local date, so a refresh near midnight in your time zone may count as a different day than you expect.
This matters in two cases:
- If your source stores local times, the last partition may include or exclude hours differently from what you expect around midnight.
- If you compare partition ranges with your own reports, an offset of up to a day can appear. It is not a data error.
If this causes trouble, store dates in a consistent time zone at the source, or filter on a date key that does not carry a time zone.
Integer date keys
The parameters are always Date/Time, even when the table has an integer key such as 20261127. The service still passes Date/Time boundaries, so your query must convert them to the same key format before it filters.
let
Source = Sql.Database("myserver.database.windows.net", "SalesDb"),
FactSales = Source{[Schema = "dbo", Item = "FactSales"]}[Data],
StartKey = Date.Year(RangeStart) * 10000 + Date.Month(RangeStart) * 100 + Date.Day(RangeStart),
EndKey = Date.Year(RangeEnd) * 10000 + Date.Month(RangeEnd) * 100 + Date.Day(RangeEnd),
Filtered = Table.SelectRows(FactSales, each [DateKey] >= StartKey and [DateKey] < EndKey)
in
FilteredEach partition computes its own StartKey and EndKey, so a day partition for 20 November filters DateKey >= 20261120 and DateKey < 20261121. Check that this conversion folds, or each partition will scan the table.
Common problems with partitions
- The policy and the filter disagree. If the filter in the query does not use both
RangeStartandRangeEnd, partitions overlap or leave gaps. Use the exact parameter names and one inclusive and one exclusive boundary. - Rows outside any partition. Rows dated before the start of the rolling window are never loaded. That is expected, not a loss. Rows dated in the future beyond the incremental window are also not loaded unless you use hybrid tables.
- Changing the policy. Republishing a changed policy does not rebuild the data right away. The new layout applies at the next refresh, and partitions that no longer match may need to be reprocessed. Plan for a larger first refresh after a change.
- Republishing from Desktop. Publishing the file again over a service model that has a policy replaces the model and loses its partitions. The next refresh is another full first load. Use a deployment tool or the XMLA endpoint to change a model without losing partitions.
The last point is why teams that make frequent changes often keep the model definition in source control and deploy it with tools, instead of republishing the file.
Where partition details are visible
Desktop shows no partitions for the table, because it loads only the slice defined by the development values of the two parameters. The partitions appear in the service after the first refresh.
You can see them with a tool that connects to the XMLA endpoint, such as SQL Server Management Studio. That requires a Premium capacity, Premium Per User, or Fabric capacity with XMLA read access enabled. A later chapter shows how to inspect and refresh single partitions.
Summary of the working model
- A policy is a rule. Partitions are what the service builds from it.
- Partitions are archive or incremental, plus an optional real-time partition for hybrid tables.
- Older data is stored in coarser partitions, such as months and years.
- Each partition runs your query with its own boundaries. A filter that folds makes each one cheap.
- Each refresh adds new partitions, reloads the incremental ones, merges aged ones, and drops those outside the window.
Exercise
A table has a policy that keeps three years of data and refreshes the last seven days. The filter in Power Query uses [OrderDate] >= RangeStart and [OrderDate] <= RangeEnd. What problem can this cause, and how do you fix it?
Show answer
Both boundaries are inclusive. A row with an OrderDate exactly equal to a partition boundary, such as midnight, falls into two adjacent partitions and loads twice, so totals can be too high. Change the second comparison to <, so the filter is [OrderDate] >= RangeStart and [OrderDate] < RangeEnd. Then each row belongs to exactly one partition.
Exercise
You change the incremental period of a published model from 10 days to 30 days in Desktop and republish the file. Why can the next refresh be much slower than your usual daily refresh, and what can you use to avoid it?
Show answer
Republishing the file replaces the service model and discards the existing partitions, so the next refresh rebuilds the whole table as a first load. To avoid this, deploy the changed policy with a deployment tool or the XMLA endpoint instead of republishing the .pbix file, so existing partitions are kept.
Exercise
Why does Power BI Desktop show no partitions for an incremental table, and where can you see them?
Show answer
Desktop loads only the slice defined by the development values of RangeStart and RangeEnd, and it does not apply the policy. The service creates partitions on the first refresh after publishing. You can see them by connecting a tool such as SQL Server Management Studio to the XMLA endpoint of a workspace on Premium, Premium Per User, or Fabric capacity.