Sub topic 11
Hybrid tables: adding a DirectQuery partition for the latest data
This chapter assumes you can already define a refresh policy, that your table's filter on RangeStart and RangeEnd folds to the source, and that you know the difference between Import and DirectQuery storage modes.
The problem: scheduled refresh is never fully current
Incremental refresh shortens each refresh, but the data is still only as fresh as the last refresh. If the source gets new rows every minute and you refresh eight times a day, report users can be hours behind.
A hybrid table fixes this for the newest data only. Power BI keeps the older data in Import partitions and adds one DirectQuery partition for the most recent period. Queries on that partition go to the source at report time.
How the partitions are laid out
With the real-time option on, the service builds three kinds of partitions from the policy.
- Archive partitions hold older data, imported and kept in memory.
- Incremental partitions hold recent data, imported and refreshed on each run.
- One DirectQuery partition covers everything after the incremental window, up to the present.
The DirectQuery partition is not filtered by RangeEnd. It has no upper boundary, so rows the source adds after the last refresh show up in reports immediately.
Turning it on
In Power BI Desktop, open the table's Incremental refresh and real-time data dialog. Set the archive and incremental periods as you did before, then select Get the latest data in real time with DirectQuery (Premium only).
Desktop does not create the DirectQuery partition. It appears only after you publish to a workspace on a Premium, Premium Per User, or Fabric capacity and the first refresh runs. In the model metadata, the policy gains a mode of hybrid:
{
"refreshPolicy": {
"policyType": "basic",
"mode": "hybrid",
"rollingWindowGranularity": "year",
"rollingWindowPeriods": 5,
"incrementalGranularity": "day",
"incrementalPeriods": 10
}
}Requirements and constraints
The DirectQuery partition sends the same query to the source on every report interaction, so the table has to support that.
- The source must support DirectQuery. Many file and web connectors do not.
- The query must fold. A step that breaks folding cannot be turned into a native source query for the DirectQuery partition, so it fails.
- The workspace must be on Premium, Premium Per User, or Fabric capacity.
- Dimension tables related to the hybrid table should use Dual storage mode. Otherwise the relationship crosses storage-mode boundaries and Power BI treats it as limited. Limited relationships can change how filters and aggregations behave.
Because the DirectQuery partition runs against a live source, its speed depends on that source. An unindexed date column that was acceptable for a nightly import can make an interactive report slow.
When to choose a hybrid table
| Situation | Choice |
|---|---|
| Hours of latency are acceptable | Plain incremental refresh |
| Users need the current day's rows as they arrive | Hybrid table |
| Source cannot handle many live queries | Plain incremental refresh, refreshed more often |
| Source does not support DirectQuery | Plain incremental refresh |
| No Premium or Fabric capacity | Plain incremental refresh |
Checking that it works
After the first refresh, connect with a tool that can reach the XMLA endpoint, such as SQL Server Management Studio, and look at the table's partitions. You should see the Import partitions plus one with DirectQuery mode. If the DirectQuery partition is missing, check that you selected the real-time option before publishing, and that the workspace is on a supported capacity. If you republish a dataset with a changed policy, refresh again so the partitions are rebuilt.
Exercise
Your report must show orders within a minute of being written to a SQL source. Your workspace is on a Pro license only, and the source is SQL Server. Can a hybrid table meet this, and why?
Show answer
No, not as set up. The real-time DirectQuery option requires a Premium, Premium Per User, or Fabric capacity workspace. SQL Server supports DirectQuery and the query can fold, so the source is fine. You would need to move the dataset to a supported capacity first.
Exercise
A hybrid table's report is slow only when the filter covers today's date. Which partition is likely responsible, and what should you check?
Show answer
The DirectQuery partition, because today's rows are read from the source at query time. Check the source's performance on the date column, for example whether it is indexed, and whether the query folds to a simple WHERE clause.