Skip to content

Optimize Power BI Semantic Models in Fabric

Step 19 of 20

Optimize Power BI Semantic Models in Fabric: Direct Lake and Incremental Refresh

Introduction

Optimize Power BI semantic models in Fabric by measuring the slow operation before changing the model. This DP-600 lesson covers visual timings, DAX query plans, Direct Lake framing and fallback, and incremental refresh for Import tables. The examples distinguish model size, capacity memory and data-access constraints.

Learning objectives

  • Use Performance Analyzer, DAX query view, DAX Studio, Tabular Editor and the Best Practice Analyzer to diagnose problems.
  • Reduce model size and improve query speed with column, cardinality and data type decisions.
  • Rewrite slow DAX with variables, simpler filters and fewer iterations.
  • Configure Direct Lake behavior (DirectLakeBehavior), understand fallback triggers and framing.
  • Choose between Direct Lake on OneLake and on SQL analytics endpoint.
  • Implement incremental refresh for Import tables and plan refresh for large models.

1. How a query is processed

A visual sends a DAX query to the semantic model. Two engines handle it:

Engine Role
Storage engine (SE) Fast, multi-threaded scans of compressed columns; returns data caches (VertiPaq in Import and Direct Lake, SQL in DirectQuery)
Formula engine (FE) Single-threaded; evaluates the DAX logic, row-by-row iterators, complex calculations on the data caches

Fast models push work to the storage engine: simple aggregations over columns and Boolean filters. Some slow queries spend time on formula-engine work or large intermediate results. Others wait for source queries, column loading or capacity resources. Use the timings and plan to identify which case applies.

2. Diagnosing performance

Tool What it shows Typical use
Performance Analyzer (Power BI Desktop and service) Per visual: DAX query time, visual display time, other time Find which visual is slow and whether the cause is the query or the rendering
DAX query view Run and edit DAX queries against the model, including DEFINE MEASURE, and update measures Test a rewrite of a measure
DAX Studio (external) Server timings with SE/FE split, query plans Deep analysis of slow queries
Tabular Editor (external) Edit the model, scripts and run the Best Practice Analyzer rules Flag metadata rules, relationships and formats that need review
VertiPaq Analyzer / Model Metrics (DAX Studio) Size per table, column and relationship, cardinality Find the columns that make the model big
Fabric Capacity Metrics app CU consumption and throttling per item Identify the models that overload the capacity
Semantic model memory and residency metrics Resident data and memory consumption where exposed Compare cold and warm Direct Lake queries

Reading a Performance Analyzer capture:

  • Long DAX query time: optimize the measure, model or data source.
  • Long visual display time: too many data points, a heavy custom visual, or too many visuals on the page.
  • Long other time can include waiting for other visuals and background preparation. Repeat the measurement with the visual isolated before attributing it to one cause.

Example. A page loads in 14 seconds. Performance Analyzer shows 11 visuals; one matrix takes 9 seconds of DAX query time, the others under 0.5 seconds each. Start with that matrix, then remeasure page interactions and capacity behavior.

3. Reducing model size and speeding up queries

Reducing unused data can improve Import and Direct Lake models. Preserve the required grain and verify the effect on memory, refresh and query latency.

Action Why it helps
Remove unused columns and tables Memory and scan time drop
Reduce cardinality of columns VertiPaq compresses columns with few distinct values best
Split datetime into date and time (or drop the time part) A timestamp with seconds has huge cardinality
Use integer surrogate keys instead of text keys Smaller dictionaries, faster joins
Avoid high-cardinality GUID or free-text columns High distinct counts can require larger dictionaries and data structures
Choose the right data types (integer, fixed decimal, not text) Smaller and faster
Prefer measures to calculated columns Calculated columns consume memory
Move row-level logic upstream (Delta table, SQL view, dataflow) A stored source column can be reused by multiple models. A view is still evaluated when queried
Use a star schema and avoid bidirectional relationships Simple filter paths
Disable auto date/time Removes hidden date tables
Use aggregations on huge DirectQuery tables Summary queries hit a small Import table
Reduce visuals per page and limit slicers Fewer queries per interaction

Worked example: shrinking a 9 GB model.

Statement. An Import model of web events is 9 GB. Vertipaq Analyzer shows 70% of the size comes from FactEvents[EventTimestamp] (millisecond precision, 200 million distinct values), FactEvents[SessionGuid] and a text column UserAgent that nobody uses in reports.

Reasoning.

  1. UserAgent is unused: remove it from the model (not just hide it).
  2. EventTimestamp is used for daily and hourly analysis only: split it into EventDate (relation to the Date table) and EventHour (integer 0–23), then remove the original. Cardinality falls from 200 million to a few thousand.
  3. SessionGuid is used only for a distinct count of sessions: keep it if required, or pre-compute a session key as an integer upstream. If sessions are not needed in the report, drop it.
  4. Re-run Vertipaq Analyzer to verify the effect.

Solution. Remove unused columns, reduce cardinality of the timestamp and use integer keys.

Why other choices are weaker. Moving to DirectQuery trades memory for latency. Hiding a column keeps its memory. Buying a larger capacity treats the symptom.

Exam tip. "Large size" and "slow refresh" with a timestamp or GUID column usually point to cardinality reduction. "Hide" does not remove data from the model.

4. DAX performance

Rules that often appear in scenarios:

Slow pattern Better pattern
FILTER ( ALL ( Fact ), Fact[Col] > 100 ) Boolean filter in CALCULATE: Fact[Col] > 100
Same sub-expression repeated VAR
SUMX over the fact table for a simple column product that could be pre-computed Pre-compute the column upstream or use a compact iteration
IF with measures evaluated in both branches inside iterators Evaluate once with VAR, or use SWITCH with simple branches
COUNTROWS ( FILTER ( ... ) ) for a simple condition CALCULATE ( COUNTROWS ( Fact ), condition )
DISTINCT ( col ) then COUNTROWS DISTINCTCOUNT ( col )
/ operator where the denominator can be zero DIVIDE (handles zero and is optimized)
Many measures invoked per row in an iterator over a large table Iterate over a smaller grain (dimension column), aggregate before
Bidirectional filters used to compute a distinct count Use a measure with CROSSFILTER or TREATAS on the one case
ISBLANK checks with IF on every row Return BLANK by design and let the visual hide blanks

Use DAX query view and DEFINE MEASURE to test a rewrite on the same query and compare timings in DAX Studio, rather than guessing.

DAX
-- Broad filter: removes filters from the expanded fact table
High Value Rows Broad Filter =
CALCULATE ( COUNTROWS ( FactSales ), FILTER ( ALL ( FactSales ), FactSales[NetAmount] > 1000 ) )

-- Narrower filter: changes the NetAmount filter
High Value Rows Column Filter =
CALCULATE ( COUNTROWS ( FactSales ), FactSales[NetAmount] > 1000 )

Note the difference in meaning: ALL ( FactSales ) also removes other filters on the fact table such as the date slicer, so the two measures are not equivalent. The column predicate preserves other ordinary filters, subject to the model relationships. Test both numeric results and timings. See advanced DAX filters and evaluation context.

5. Direct Lake in depth

5.1 How it works

Direct Lake reads the Parquet files of Delta tables in OneLake. Three notions are important.

Notion Meaning
Framing The refresh operation of a Direct Lake model: it reads the Delta log and sets which Parquet files (table versions) the model references. It is metadata-only and fast, no data is copied
Transcoding When a query first needs a column, the engine reads the Parquet column and converts it into the VertiPaq in-memory format; the column stays in memory until evicted
Warm and cold A cold column triggers a load on first query; a warm column is already in memory and fast

Framing is by default automatic: the model can update on its own when the Delta tables change (the "Keep your Direct Lake data up to date" setting). You can also trigger it from a pipeline refresh activity, the API or the portal, which is useful to keep consistency after a multi-table load: run the pipeline, then refresh the model once the last table is written.

Delta write patterns matter. Direct Lake analyzes the Delta log to drop and reload only the affected column segments. Append-only loads allow incremental framing and are efficient. A full overwrite replaces the active data files and can invalidate much of the resident data. A Delta overwrite normally creates a new transaction-log version. Dropping and recreating a table is a different operation. Prefer a load pattern that changes only the necessary rows or partitions when its semantics fit. V-Order optimization of the Parquet files, a reasonable number of files and row groups, and regular OPTIMIZE maintenance (and VACUUM with care) keep queries fast. Many tiny files hurt performance.

5.2 Guardrails and fallback

Each capacity SKU has Direct Lake resource limits. Table size, row counts, Parquet files and row groups can affect guardrails according to the flavor. The maximum resident memory is a separate paging limit and does not itself trigger fallback. When a Direct Lake model exceeds a guardrail or uses a feature that Direct Lake on the SQL endpoint cannot serve, one of two things happens depending on the flavor and the setting.

For Direct Lake on SQL analytics endpoint, the setting DirectLakeBehavior controls the response:

Value Behavior
Automatic (default) Direct Lake is used when possible; otherwise the query silently falls back to DirectQuery against the SQL analytics endpoint
DirectLakeOnly Never falls back; a query that would need fallback fails with an error
DirectQueryOnly Always use DirectQuery (useful to test fallback behavior)

Typical fallback triggers for the SQL endpoint flavor:

  • A queried source table has SQL row-level security that must be evaluated by the SQL endpoint.
  • The model references a non-materialized SQL view (a view, not a Delta table).
  • The query exceeds a capacity guardrail (for example too many rows or files). Other unsupported data types or feature combinations can cause errors instead of fallback. Inspect the actual reported reason.

Fallback is why a model can be fast in the morning and slow after a data load that exceeds a guardrail. Correlate the slow query with diagnostics. Microsoft documents EVALUATE TABLETRAITS() and its DirectLakeFallbackInfo column for table-level reasons. In a test copy, DirectLakeOnly can expose queries that need fallback, but an error alone can have another cause. Also inspect Performance Analyzer and model monitoring.

For Direct Lake on OneLake, fallback to DirectQuery does not exist. If a situation cannot be served, the query returns an error instead. This makes behavior predictable and removes the dependency on the SQL endpoint.

5.3 OneLake versus SQL analytics endpoint

Criterion Direct Lake on OneLake Direct Lake on SQL analytics endpoint
Source of metadata Delta tables in OneLake directly (lakehouse or warehouse tables, and shortcuts) Tables and views exposed by a SQL analytics endpoint
DirectQuery fallback None, errors instead Yes (Automatic)
SQL endpoint security SQL endpoint rules do not govern OneLake reads; configure equivalent OneLake and model controls SQL RLS requires fallback; queries touching SQL OLS/CLS-restricted objects return an error
Views Not supported (tables only) Views possible but non-materialized views trigger fallback
Composite storage in the model Supports Import and other modes through supported authoring paths General composite storage is unsupported within the Direct Lake on SQL model
Typical choice New models needing predictability, mixed Import tables, data in multiple Fabric items Existing models, SQL-defined security, warehouse views

Choose the flavor from the access model and supported sources, not from a performance promise. OneLake avoids DirectQuery fallback. SQL-based RLS or non-materialized SQL views can require the SQL path. Review Direct Lake storage modes and semantic model relationships.

Worked example: why did the model become slow?

Statement. A Direct Lake on SQL analytics endpoint model was fast for a month. After a data engineer added a row-level security policy on the warehouse table FactSales for regional managers, report visuals take 8 seconds instead of 1 second. The capacity metrics show higher SQL endpoint usage.

Reasoning.

  1. The new SQL policy is a likely fallback trigger. Confirm it with query and table diagnostics.
  2. Test the same query on an isolated copy with DirectLakeOnly and inspect the reported fallback reason.
  3. Keep the source protection in place while investigating. If direct SQL readers require that policy, optimize and size the SQL execution path. A migration to OneLake security or model roles needs equivalent controls across every reader path.

Solution. Treat security and performance as one architecture decision. Model RLS only protects queries through the model. Users with direct source access need source controls too.

5.4 Refresh behavior and consistency

  • Framing is quick, but a model sitting on half-loaded tables shows inconsistent data. Disable automatic updates when you need a controlled cut-over, load all tables, then trigger the framing from a pipeline.
  • A full rewrite can make the next query colder by replacing files. Compare load patterns, then measure framing and cold-query costs. MERGE can also rewrite files.
  • Direct Lake does not use incremental refresh partitions; freshness is handled by Delta-table-level partitioning and framing.

6. Incremental refresh

Incremental refresh applies to Import tables. Instead of refreshing the entire table, the service partitions it by date and refreshes only recent partitions, while historical partitions are kept.

Configuration in Power BI Desktop:

  1. Create two Power Query parameters of type Date/Time named exactly RangeStart and RangeEnd.
  2. Filter the date column of the table with >= RangeStart and < RangeEnd (one boundary inclusive only, to avoid duplicates). Push the range restriction to the source where supported and verify which data is actually retrieved.
  3. Define the policy on the table: store rows for a period (for example 5 years) and refresh rows for a recent period (for example 7 days).
  4. Optionally detect data changes using a separate audit column. The maximum audit value is compared for periods in the refresh window. Hard deletes are not detected, so plan explicit refreshes for historical corrections. For supported configurations, a hybrid policy can use DirectQuery for the newest data.
  5. Publish. The first service refresh loads the retention range. Later refreshes apply the window policy and remove data that ages out of retention.
Item Detail
Works with Eligible Import tables with date-range partitioning. Verify how the connector applies the range restriction
Needs Exact parameter names and Date/Time types, range filtering and an incremental policy
Benefits Faster refresh, less load on the source, lower memory pressure during refresh
First refresh Still processes all historical data
Relation with the large storage format Recommended for big tables; partitions can also be refreshed through the XMLA endpoint
Not for Direct Lake tables, which rely on framing instead

Example. A 400-million-row fact table refreshes in four hours every night. With incremental refresh storing 3 years and refreshing the last 3 days, only three days of partitions are reprocessed, Measure the resulting refresh duration with representative loads before setting an operational target.

Exam tip. For relational sources, confirm range filtering with folding indicators or source traces. A missing View Native Query option alone does not prove all data is fetched. Some nonfolding source patterns can still apply range parameters at the source. A hybrid DirectQuery partition needs its query to fold. Direct Lake tables use framing rather than Import incremental partitions.

7. Refresh and capacity planning

  • Schedule refreshes outside peak reporting hours; refresh consumes capacity units and can throttle interactive queries.
  • Refresh in parallel only as much as the capacity allows; a full refresh can need substantial additional memory. Measure the refresh peak as well as the resident model.
  • Use the Fabric Capacity Metrics app to see which model causes the load.
  • Prefer partition-level refresh over full model refresh for large Import models.
  • Keep one shared, certified semantic model rather than copies per report: one refresh instead of many.

Common pitfalls

  • Optimizing the whole model when Performance Analyzer shows one slow visual.
  • Hiding unused columns instead of removing them.
  • Leaving datetime columns with millisecond precision in the model.
  • Using FILTER ( ALL ( Fact ), ... ) where a column predicate is enough.
  • Assuming Direct Lake never falls back: the SQL-endpoint flavor can, silently, in Automatic mode.
  • Defining row-level security on the SQL endpoint and then wondering why the model uses DirectQuery.
  • Replacing every data file on each load without measuring the cost of cold transcoding.
  • Using a filter that does not fold with incremental refresh.
  • Configuring incremental refresh on a Direct Lake table.

Exam tip. Pick the tool from the symptom: slow visual → Performance Analyzer; slow DAX → DAX query view or DAX Studio; big model → Vertipaq Analyzer; rules and bulk edits → Tabular Editor and Best Practice Analyzer; capacity overload → Capacity Metrics app.

Mini case study

Context. Adventure Works Energy has a Direct Lake on SQL analytics endpoint model on a warehouse with 600 million rows. Symptoms: (1) some visuals alternate between 1 second and 10 seconds without any change; (2) a monthly Import budget model refreshes for 3 hours because of a 5-year transaction table with a timestamp column; (3) a measure counting order rows above €1000 uses FILTER ( ALL ( FactOrders ), ... ) and ignores the date slicer.

Questions.

  1. How do you prove and fix the first problem?
  2. How do you reduce the refresh time of the budget model?
  3. How do you fix the third problem?

Solution.

  1. Set DirectLakeBehavior to DirectLakeOnly on a test copy: visuals that error are the ones being served by fallback. Check the causes (SQL security, views, guardrails). Confirm the reason, retain the required source protection, and assess SQL optimization or an equivalent end-to-end security design. Replace a costly view with a curated Delta table when appropriate. Compact files when file counts are the problem.
  2. Reduce the timestamp to date plus hour, remove unused columns, then enable incremental refresh with RangeStart and RangeEnd, storing 5 years and refreshing 7 days, with a foldable filter. Enable the large storage format if the model exceeds the size limit.
  3. If FactOrders has one row per order, use CALCULATE ( COUNTROWS ( FactOrders ), FactOrders[NetAmount] > 1000 ) to count qualifying orders while keeping other filters. At order-line grain, define the intended order-level aggregation before counting.

Comment. Each symptom has a specific diagnostic tool and a specific fix; none requires simply buying more capacity.

Key terms

  • Storage engine / formula engine: the two components that evaluate a DAX query.
  • Performance Analyzer: tool that times each visual's query and rendering.
  • Vertipaq Analyzer: tool that reports the size of tables and columns.
  • Framing: Direct Lake refresh that points the model to current Delta versions.
  • Transcoding: loading Parquet columns into the in-memory format.
  • Guardrail: capacity limit beyond which Direct Lake can fall back or fail.
  • DirectLakeBehavior: setting that selects Automatic, DirectLakeOnly or DirectQueryOnly.
  • Incremental refresh: partitioned Import refresh using RangeStart and RangeEnd.
  • Hybrid table: incremental refresh table whose latest partition uses DirectQuery.

Summary checklist

  • I can choose the diagnostic tool from the symptom.
  • I can reduce model size by removing columns and lowering cardinality.
  • I can rewrite slow DAX with variables and column predicates.
  • I can explain framing, transcoding, guardrails and fallback.
  • I can name the fallback triggers and the three DirectLakeBehavior values.
  • I can choose between Direct Lake on OneLake and on SQL analytics endpoint.
  • I can configure incremental refresh and explain why folding matters.
  • I know that Direct Lake uses framing, not incremental refresh partitions.

Official sources