Sub topic 9
Refreshing only complete periods
This chapter assumes you have already set up RangeStart and RangeEnd, filtered a table with them, and defined a refresh policy with an archive period and an incremental period. It covers one optional setting, Only refresh complete periods, and when to turn it on.
The problem: partial periods
An incremental refresh policy refreshes a window of recent periods. If the incremental granularity is a day, the newest partition is today's partition. Today is not finished, so that partition holds only some of the day's rows.
That is usually fine. Tomorrow's refresh reloads the partition for today and the rows that arrived later are picked up. The trouble starts when a report must not show half a period. Some examples:
- A monthly sales total that looks low because the month has only just started.
- A week-over-week comparison where the current week is partial and the previous week is complete.
- A source system that writes a full day's rows in one nightly batch, so any earlier snapshot of that day is incomplete or inconsistent.
What the setting does
With Only refresh complete periods on, the service refreshes only partitions whose period has fully ended. The current, unfinished period is skipped.
The rule depends on the incremental granularity you chose in the policy:
| Incremental granularity | Refreshed on a given day | Skipped |
|---|---|---|
| Day | Whole days before today | Today |
| Month | Whole months before this month | The current month |
| Year | Whole years before this year | The current year |
For example, suppose the policy refreshes the last 10 days and the setting is on. A refresh on 15 March loads 5 March through 14 March. Data for 15 March is not loaded until the refresh that runs on 16 March.
{
"refreshPolicy": {
"policyType": "basic",
"rollingWindowGranularity": "year",
"rollingWindowPeriods": 5,
"incrementalGranularity": "day",
"incrementalPeriods": 10
}
}The metadata above describes the policy. The complete-periods setting is a checkbox in the same Desktop dialog. In the model it is stored alongside the policy, so you do not change the date filter or the parameters to use it.
Choosing a good "complete" definition
The word "complete" here means the calendar period has ended. It does not mean the source has finished loading that period's data. If your source lands yesterday's rows at 06:00 and your refresh runs at 02:00, a partition for "yesterday" can still be incomplete when it is loaded, and it will be loaded only once more if the next refresh falls outside the window.
Keep two points in mind:
- Schedule the refresh after the source finishes its load for the last complete period.
- Keep the incremental window longer than one period. A window of several days gives late-arriving rows more than one chance to be picked up.
Using it with detect data changes
You can combine this setting with Detect data changes. Detect data changes skips a partition when a change-tracking column, such as LastModifiedDate, shows nothing changed. Complete periods decides which partitions are candidates. Detect data changes then decides which of those candidates actually reload.
Trade-offs
The setting trades freshness for consistency.
- Benefit: Every loaded partition is a finished period, so totals and comparisons are not distorted by a partial period.
- Cost: The newest data is always at least one period old. With daily granularity, today's rows are not in the model until tomorrow.
If users need today's numbers and also need complete earlier periods, this setting alone does not help. A hybrid table, which adds a DirectQuery partition for the latest data, is the usual answer and is covered in a later chapter.
Common mistakes
- Expecting today's data with daily granularity. The report is working as configured. The current day is skipped by design.
- Choosing a coarse granularity. With monthly incremental granularity and this setting on, the current month does not appear until it ends. That is often longer than users will accept.
- Treating the setting as a data-quality guarantee. It only looks at the calendar. It cannot detect a source that is still loading.
Exercise
A policy archives 3 years and refreshes the last 7 days incrementally. "Only refresh complete periods" is on. A scheduled refresh runs on Wednesday morning. Which days does it load in the incremental window, and why are users who look for Wednesday's sales not seeing them?
Show answer
It loads the seven complete days before Wednesday, which are the previous Wednesday through Tuesday. Wednesday is the current, unfinished day, so its partition is skipped. Wednesday's rows appear after the refresh that runs on Thursday. If users need same-day numbers, add a hybrid table with a DirectQuery partition or turn the setting off and accept a partial current day.