Sub topic 1
Import, DirectQuery, and live connection: what gets refreshed
Prerequisites
This chapter assumes you already know the following:
- Basic Power BI concepts: datasets (also called semantic models), reports, and workspaces.
- How to build a report in Power BI Desktop and shape data with Power Query.
- Common data sources such as SQL Server and Excel files.
- Basic Windows and networking ideas, such as services, firewalls, and outbound ports.
You do not need to know anything about gateways yet. Later chapters cover them. This chapter explains the storage mode of a dataset, which decides whether scheduled refresh applies to it at all.
Why storage mode comes first
Every dataset gets its data from somewhere. The storage mode says where that data sits when someone opens a report. It answers two questions:
- Does the Power BI service keep its own copy of the data?
- If it does, how does that copy stay current?
Many refresh problems start with a wrong answer to these questions. People set up a refresh schedule for a dataset that has nothing to refresh. Others expect a report to show new rows when the dataset only holds an old copy. This chapter separates the three common modes: Import, DirectQuery, and live connection. A fourth case, composite models, mixes them.
Import mode
In Import mode, Power BI Desktop runs your Power Query queries and loads the results into the dataset. The dataset stores them in a compressed, in-memory columnar format called VertiPaq. When you publish, the service holds that snapshot.
Key properties:
- Report interactions are fast. Visuals query the stored copy and never contact the source.
- The data is only as new as the last refresh. Rows added to the source afterward do not appear.
- The source does not have to be online when users view the report. It must be reachable only when a refresh runs.
- Dataset size is limited. The limit depends on your license and capacity, so check the current documentation for your tier.
Import is the only mode that needs scheduled refresh. A refresh re-runs the queries and replaces the stored copy. Chapter 2 covers how that works.
Here is a typical Import query. Power Query connects to SQL Server and reads one table:
let
Source = Sql.Database("sql01.contoso.local", "Sales"),
Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data]
in
OrdersIn Import mode, this query runs at refresh time. The result is stored. Users never trigger it by opening a report.
DirectQuery mode
In DirectQuery mode, the dataset stores metadata only: table names, columns, relationships, and measures. It holds no rows. When a user opens a report or changes a slicer, Power BI translates the visuals into queries, such as SQL, and sends them to the source.
Key properties:
- Results reflect the source at the moment of the query, subject to caching.
- There is no data copy to refresh. Scheduled refresh does not apply to the data itself.
- The source must be online and reachable whenever someone uses the report.
- Report speed depends on the source. A slow database makes a slow report.
- Some Power Query transformations and DAX functions are restricted, because everything must translate to the source's query language.
DirectQuery still has a refresh-related setting. The service caches query results for tiles on dashboards and reports. A schedule can refresh that tile and visual cache at an interval you choose. It does not reload data into the dataset. The cache only controls how often the service re-asks the source for the values it shows on pinned tiles.
If the source is on-premises, the service must reach it on every user query. A gateway is required, and it is used at report time, not just at refresh time. Chapter 3 covers that.
Live connection
A live connection links a report to an existing model that lives elsewhere. The two common cases are SQL Server Analysis Services (SSAS) and a published Power BI dataset. The report holds no model of its own. It only has visuals. You cannot add tables, change relationships, or define new model measures in the report. In some scenarios you can add report-level measures.
Key properties:
- The model is owned and updated by someone else. You do not set up refresh in the report.
- For an SSAS model, the Analysis Services administrator processes the model on their own schedule.
- For a shared Power BI dataset, the dataset owner configures its refresh. Reports built on it see new data once the dataset refreshes.
- An on-premises SSAS source needs a gateway for queries at report time.
The choice here is not about whether the data is fresh. It is about who controls freshness. If a live-connected report looks stale, the fix belongs with the model owner, not in the report.
Comparing the modes
| Aspect | Import | DirectQuery | Live connection |
|---|---|---|---|
| Rows stored in the service | Yes, a snapshot | No | No, held by the remote model |
| Needs scheduled refresh | Yes | No (optional tile cache refresh) | No (the model owner refreshes it) |
| Source contacted at view time | No | Yes | Yes (the remote model) |
| Gateway for on-premises source | At refresh time | At every query | At every query |
| Freshness | As of last refresh | Near real time | As fresh as the remote model |
| Model editing in the report | Full | Full, with limits | Not allowed |
Composite models
A composite model combines storage modes in one dataset. For example, a large fact table can use DirectQuery while small dimension tables use Import. Each table has its own storage mode, shown in Power BI Desktop's model view.
The consequences for refresh are:
- Scheduled refresh applies only to the Import tables.
- DirectQuery tables are queried live.
- If any source is on-premises, the gateway is needed for both purposes.
Treat each table separately when you decide what needs refreshing.
Deciding what to expect
The diagram shows the decision path for one dataset.
Common errors
- Scheduling refresh on a DirectQuery dataset and expecting new data to load. The schedule only affects cached tiles. Rows are already read live.
- Treating "Refresh now" as a fix for a live-connected report. The refresh option belongs to the dataset the report points to, not to the report.
- Assuming Import reports show real-time data. They show the last successful refresh. Check the refresh history (a later chapter).
- Forgetting that DirectQuery sources must stay online. An offline database breaks the report for every user, not only during a refresh window.
- Mixing up the two gateway uses. In Import mode the gateway is used when a refresh runs. In DirectQuery and live connection it is used for every user query.
Summary
Import copies data into the service, so it needs scheduled refresh. DirectQuery and live connection keep no copy of their own. They need an available source or model instead. Composite models mix these, and refresh applies only to their Import tables. Knowing the storage mode tells you whether a refresh schedule is relevant, who controls freshness, and when a gateway will be used.
Exercise
A dataset contains one Import table of product names and one DirectQuery table of sales transactions from an on-premises SQL Server. A user says new transactions appear in the report right away, but a new product added yesterday is missing. What explains this, and what should you configure?
Show answer
The DirectQuery sales table is queried live on each interaction, so new transactions show immediately. The product table is Import mode, so it holds a snapshot that is only as new as the last refresh. Configure scheduled refresh for the dataset so the Import table is reloaded. Because the source is on-premises, a gateway is needed both for the refresh and for the live DirectQuery queries.
Exercise
A report is connected live to a shared Power BI dataset. Its numbers are two days old. Where should you look to fix this?
Show answer
Look at the shared dataset, not the report. A live-connected report has no data or refresh settings of its own. Check the dataset's refresh schedule and refresh history, or contact its owner.