Sub topic 1
What a semantic model does and why storage mode matters
Prerequisites
This chapter assumes you can already do the following:
- Use Power BI Desktop to connect to data, build a model, and make a report.
- Read a star schema, meaning fact tables (events such as sales) joined to dimension tables (descriptions such as date, product, customer).
- Write a basic DAX measure.
- Read simple SQL against a relational database.
You don't need Microsoft Fabric experience. It helps for the Direct Lake chapters later, so know that Fabric is Microsoft's analytics platform and that a workspace is the container where items such as models and reports live.
What a semantic model does
A Power BI semantic model is the layer between your data sources and your reports. Older documentation calls it a dataset. It is hosted by the Analysis Services Tabular engine, which Power BI runs for you in the service and inside Power BI Desktop.
A report does not read your database directly. Each visual asks the semantic model a question, and the model answers it. The model has three jobs:
- Define meaning. It holds tables, relationships, hierarchies, and measures. A measure such as
Total Salesis written once and gives the same answer in every report. - Answer queries. Each visual sends a DAX query to the model. The model works out which data it needs, gets that data, and returns a small result table.
- Apply rules. Row-level security (RLS) roles, refresh settings, and source credentials are part of the model, so every report that uses the model inherits them.
Because many reports can connect to one model, a choice made in the model affects all of them. That is why the storage mode matters.
What a query does inside the model
A DAX query is processed by two cooperating parts:
- The formula engine parses the DAX, builds a query plan, and evaluates the measure logic.
- The storage engine fetches the raw data the formula engine asks for, such as "sum of quantity by year".
The formula engine behaves the same in every storage mode. The storage engine is what changes. For Import tables it is VertiPaq, an in-memory columnar engine. For DirectQuery tables it sends SQL to the source system. For Direct Lake tables it uses VertiPaq on columns that it loads from Delta files in OneLake.
What storage mode is
Storage mode is a table-level property that says where the model gets that table's data when a query runs. The main values are:
| Mode | Where the data is at query time | Data is copied into the model? |
|---|---|---|
| Import | In memory, in the VertiPaq engine | Yes, on refresh |
| DirectQuery | At the source; the model sends queries | No |
| Direct Lake | Delta tables in OneLake; columns are loaded into memory as needed | No copy step; the model reads the Delta files |
| Dual | Either: acts as Import or DirectQuery depending on the query | Yes, and it can also be queried at the source |
Dual is mainly a tool for composite models, where one model mixes modes. It gets its own treatment in a later chapter.
In Power BI Desktop, you can set the mode in Model view. Select a table, then open the Properties pane, expand Advanced, and choose a value under Storage mode. In a model built on Direct Lake, the mode is a property of the model's tables, and you work with it in Fabric.
Some changes can't be undone:
- You can change a DirectQuery table to Import, but not the other way around.
- Changing a table to Dual is allowed, and so is changing it back.
- A model that uses Direct Lake tables has its own limits on mixing with other modes, so check the current Microsoft documentation before planning a mix.
Why the choice matters
The storage mode decides five things you will care about in production.
- Freshness. Import data is as old as the last refresh. DirectQuery returns what the source holds now. Direct Lake reflects the Delta table version the model last picked up.
- Query speed. In-memory columnar data is usually fast. DirectQuery speed is limited by the source and the network, and every visual interaction becomes a source query.
- Capacity and size. Import stores a compressed copy, so model size counts against limits. DirectQuery stores almost nothing. Direct Lake keeps data in OneLake and loads only the columns queries touch.
- Load on the source. Import queries the source during refresh. DirectQuery queries it every time someone opens or filters a report.
- Features and security. DirectQuery restricts some DAX and Power Query features, and security behaves differently, because credentials and RLS interact with the source. Later chapters cover these in detail.
There is no best mode. Each one gives up something to gain something else, so you choose from the requirements of the scenario.
One measure, three behaviors
Consider this measure:
Total Sales = SUMX ( Sales, Sales[Quantity] * Sales[UnitPrice] )You write it once. What happens when a visual evaluates it depends on the table's mode:
- Import or Direct Lake: VertiPaq scans the
QuantityandUnitPricecolumns in memory and computes the sum. - DirectQuery: the model translates the request into a SQL query that the source database runs, and the source returns an aggregated result.
This DAX query is the kind a visual generates. You can run it in DAX Studio, or copy it from the Performance Analyzer pane in Power BI Desktop:
EVALUATE
SUMMARIZECOLUMNS (
'Date'[Year],
"Total Sales", [Total Sales]
)
ORDER BY 'Date'[Year]The query text is the same under every mode, but its cost differs. In an Import model it is usually a quick in-memory scan. Under DirectQuery you would see SQL events in the trace, and the time is dominated by the source. Comparing these two traces is the most direct way to see what storage mode does, and you will use that method again in the final chapter.
Common errors at this stage
- Treating the report as the unit of design. Storage mode belongs to the model. If three reports share a model, changing a table's mode changes all three.
- Assuming DirectQuery means "always real-time". The source may itself be loaded on a schedule, and the report can cache query results. DirectQuery removes the model's own copy, not every delay.
- Assuming Import is always the safest default. It is often right, but a very large table, a strict freshness need, or a rule that data cannot be copied can rule it out.
- Forgetting that mode is per table. A model is not simply "an Import model". Check each table in Model view, because a model can hold a mix.
- Planning to switch later. Because Import to DirectQuery is not allowed for a table, a wrong first choice can mean rebuilding the table or the model.
Where the next chapters go
The rest of the tutorial follows the concept graph. You first meet the mode properties, then VertiPaq and Import with scheduled and incremental refresh. Next come DirectQuery and its limits, then OneLake, Delta tables, and Direct Lake with framing and fallback. After that come composite models, aggregations, and security, and the tutorial ends with a decision guide and Performance Analyzer.
Exercise
A team has one semantic model feeding four reports. A fact table in the model is set to Import, and refresh runs nightly. A manager complains that Report 2 shows yesterday's sales. Which two parts of the model decide what Report 2 shows, and why can't the team fix this in the report alone?
Show answer
The table's storage mode (Import) and the refresh schedule decide it. Report 2 only sends DAX queries to the semantic model, and the model answers from its in-memory copy, which is as old as the last refresh. Changing the report cannot change that copy. The team would need to change the model: refresh more often, use incremental refresh, or move the table to DirectQuery or Direct Lake. Because the four reports share the model, any such change also affects the other three.
Exercise
In the DAX query from this chapter, which part of the model's work stays the same across Import, DirectQuery, and Direct Lake, and which part changes?
Show answer
The formula engine work stays the same: it parses the DAX and evaluates the measure logic. The storage engine changes. For Import and Direct Lake it reads data in VertiPaq memory. For DirectQuery it sends SQL to the source database.