The morning refresh comes round, and Query Store points at the same fact table it always does. The sessions doing the reading belong to something called Mashup Engine, connecting from the gateway server. The reads look about the size of the whole table, even though the BI team set up incremental refresh months ago.
Power BI incremental refresh changes how the model stores and reloads its own copy of the data. It only cuts the work on SQL Server if the date filter reaches the server. When it doesn't, the server can do as much work as before, sometimes more, and the DBA is usually the first to notice. You don't need access to Power BI to work out what's going on. From SQL Server alone, you can see whether the date filter is arriving, which tells you whether the fix is yours or the BI team's. I'll go through what to change in each case, with results from a 20-million-row test table.
This follows on from my last article, What Power BI DirectQuery does to your SQL Server, where I suggested that if your data isn't enormous, Import mode with incremental refresh is often a better choice than DirectQuery. That advice still stands, as long as the refresh is set up well.
What Power BI incremental refresh really does
In Import mode, Power BI keeps its own compressed copy of the data (the semantic model) and, by default, reloads each table in full on every scheduled refresh.
Incremental refresh changes that by splitting a big table into date-based partitions inside the model. The Power BI developer adds two parameters with the reserved names RangeStart and RangeEnd and filters a date column between them. Then they set a policy like "keep five years, refresh the last ten days". On the first refresh after publishing, the Power BI service creates the partitions (years for old data, then quarters, months and days as you get closer to today).
On a scheduled refresh, Power BI reruns the table's Power Query logic for each partition in the refresh window, with that partition's start and end dates. So a "refresh the last ten days" policy with daily partitions means roughly ten separate date-bounded queries, not one query covering ten days. Expect a few extra metadata queries too, so measure it yourself.
Behaviours that catch DBAs out
The first refresh after publishing loads the entire history. That's by design, so expect a big first read.
Republishing the model from Power BI Desktop throws the partitions and their data away, so the next refresh is another full historical load. If your server suddenly reads five years of sales again after months of light mornings, "did anyone republish the PBIX yesterday?" is a sensible first question. On Premium-type workspaces, metadata-only deployment (with ALM Toolkit or TMSL scripts, for example) avoids that reset.
"Detect data changes" adds polling. The developer picks an audit column, such as LastModified. For each partition in the window, Power BI checks the maximum value of that column. If that value hasn't moved since the last refresh, it skips the partition, so it only fully reads the partitions that changed.
Incremental refresh works on Power BI Pro, too. The real-time DirectQuery partition (a "hybrid table") needs Premium, Premium Per User or Embedded, but plain incremental refresh doesn't.
What arrives at your server
When it's working, each partition's query carries the date range down to SQL Server. The exact text varies, but the shape is typically:
select [_].[FactSalesId], [_].[SaleDate], [_].[StoreKey], [_].[ProductKey],
[_].[Quantity], [_].[UnitPrice]
from [dbo].[FactSales] as [_]
where [_].[SaleDate] >= convert(datetime2, '2026-11-01 00:00:00')
and [_].[SaleDate] < convert(datetime2, '2026-11-02 00:00:00')Look for the WHERE clause. It should be there as a half-open range, sitting directly on the column rather than inside a function.
When it isn't working, the same partition looks like this:
select [_].[FactSalesId], [_].[SaleDate], [_].[StoreKey], [_].[ProductKey],
[_].[Quantity], [_].[UnitPrice]
from [dbo].[FactSales] as [_]No date range at all. This happens when something in the Power Query steps stops "query folding", which is Power Query's ability to translate its steps into SQL and push them to the source. When folding stops before the date filter, Power Query pulls every row from SQL Server and filters them itself. That defeats the point of incremental refresh.
It's worse than a single full refresh as well. With a ten-day window and broken folding, SQL Server can read the whole table ten times every morning, and the gateway throws away nearly all of it each time.
Is it folding, or is it your table?
Three different situations can all look like "Power BI is scanning my fact table", and each one has a different fix:
- The query has no date predicate. That's a folding problem, and the fix lives in Power Query.
- The query has the date predicate, but SQL Server still scans. That points at the table design. The range is there, the table just can't answer it cheaply.
- The scan is expected. A first refresh, a republish, or someone refreshing old partitions on purpose.
Testing it on a 20-million-row table
The second one surprises people, and so I tested it. I built a 20-million-row fact table on SQL Server 2025: about 11,000 rows a day over five years, 1.3 GB as a heap. Then I ran the same queries against different physical designs. Each query selected every column into variables so I was measuring work on the server, not rows being drawn in SSMS. These are warm-cache elapsed times on one workstation (the second of two runs), so look at the ratios rather than the milliseconds.
| Table design | One-day partition | Ten-day range | No date filter |
|---|---|---|---|
| Heap, no indexes | 168,068 reads, 1.65 s | 168,068 reads, 1.58 s | 168,068 reads, 6.35 s |
| Clustered index on (SaleDate, FactSalesId) | 98 reads, 4 ms | 928 reads, 36 ms | 168,550 reads, 6.24 s |
| Clustered columnstore (ordered; unordered was near-identical) | 3,390 LOB reads, 69 ms | 3,991 LOB reads, 103 ms | 124,170 LOB reads, 6.88 s |
On the heap, a perfectly folded one-day query read every page in the table. (Same reads, different times: that's the cost of handling 20 million rows rather than 11,000.) Power BI had done its job and the database still did a full scan, so the SQL text alone can't diagnose this.
The clustered index on the date column turned the same query into 98 page reads. A broken refresh with ten partitions would mean roughly ten full scans: around 1.7 million reads and about a minute of CPU on my machine. (I measured CPU separately, and each full scan used about six seconds.) A healthy refresh costs about a thousand reads.
Catching it from the SQL Server side
There are three things to do to catch this. First, find the Power BI sessions, then capture the refresh queries, and finally compare the reads with the table. Each of these is outlined below.
Find the Power BI sessions
Power BI's Power Query engine identifies itself to SQL Server as Mashup Engine. Depending on where the refresh runs, it may add a suffix such as (PowerBIPremium-Import). Through an on-premises gateway, the host name is normally the gateway server. The client supplies both values, so treat them as clues rather than proof. Run this during a known refresh to see what your environment reports:
SELECT program_name, host_name, login_name, COUNT(*) AS sessions FROM sys.dm_exec_sessions WHERE is_user_process = 1 GROUP BY program_name, host_name, login_name;
Then watch those sessions during the refresh, swapping in your own program name if it differs:
SELECT s.session_id, s.login_name, s.host_name, s.program_name,
r.status, r.total_elapsed_time AS elapsed_ms, r.logical_reads,
t.text AS sql_text
FROM sys.dm_exec_sessions AS s
LEFT JOIN sys.dm_exec_requests AS r ON r.session_id = s.session_id
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE s.is_user_process = 1
AND s.program_name IN (N'Mashup Engine', N'Mashup Engine (PowerBIPremium-Import)')
ORDER BY r.logical_reads DESC;Capture every refresh query with Extended Events
Query Store doesn't record the application name, so to tie queries to the Power BI refresh, use Extended Events. Change the file path to somewhere the SQL Server service account can write (on Azure SQL Database, create it ON DATABASE with a storage target):
IF EXISTS (SELECT 1 FROM sys.server_event_sessions WHERE name = N'PowerBIRefresh')
DROP EVENT SESSION PowerBIRefresh ON SERVER;
GO
CREATE EVENT SESSION PowerBIRefresh ON SERVER
ADD EVENT sqlserver.rpc_completed
(
ACTION (sqlserver.client_app_name, sqlserver.client_hostname,
sqlserver.database_name, sqlserver.sql_text)
WHERE sqlserver.client_app_name = N'Mashup Engine'
OR sqlserver.client_app_name = N'Mashup Engine (PowerBIPremium-Import)'
),
ADD EVENT sqlserver.sql_batch_completed
(
ACTION (sqlserver.client_app_name, sqlserver.client_hostname,
sqlserver.database_name, sqlserver.sql_text)
WHERE sqlserver.client_app_name = N'Mashup Engine'
OR sqlserver.client_app_name = N'Mashup Engine (PowerBIPremium-Import)'
)
ADD TARGET package0.event_file (SET filename = N'D:\XE\PowerBIRefresh.xel',
max_file_size = 100, max_rollover_files = 5)
WITH (MAX_DISPATCH_LATENCY = 5 SECONDS, STARTUP_STATE = OFF);
GO
ALTER EVENT SESSION PowerBIRefresh ON SERVER STATE = START;Start it before the scheduled refresh. Afterwards, in SSMS Object Explorer, expand Management > Extended Events > Sessions > PowerBIRefresh, right-click package0.event_file and choose View Target Data. Each captured query appears as a row. Click one to see its duration (in microseconds), logical reads, row count and SQL text in the Details pane. To add any of these as a column, right-click it there and choose Show Column in Table.
Stop and remove the session when you're done:
ALTER EVENT SESSION PowerBIRefresh ON SERVER STATE = STOP; DROP EVENT SESSION PowerBIRefresh ON SERVER;
When I ran it, it caught a folded one-day query at 97 reads and 10,953 rows, and an unfolded query at 168,564 reads and 20 million rows. When you do read the SQL, read all of it, because the date predicate sits after the column list.
Compare reads per execution with the size of the table
This query compares each fact-table query's average reads per execution over the last week with the table's page count. A ratio near 1.00 is a strong hint of a full read, so confirm it in the execution plan.
DECLARE @Table sysname = N'dbo.FactSales', @DaysBack int = 7;
WITH TablePages AS
(
SELECT SUM(used_page_count) AS table_pages
FROM sys.dm_db_partition_stats
WHERE object_id = OBJECT_ID(@Table) AND index_id IN (0, 1)
),
Runs AS
(
SELECT q.query_hash,
SUM(rs.count_executions) AS executions,
SUM(rs.avg_logical_io_reads * rs.count_executions) AS total_reads,
SUM(rs.avg_duration * rs.count_executions) AS total_duration_us,
MAX(qt.query_sql_text) AS sample_text
FROM sys.query_store_query_text AS qt
JOIN sys.query_store_query AS q ON q.query_text_id = qt.query_text_id
JOIN sys.query_store_plan AS p ON p.query_id = q.query_id
JOIN sys.query_store_runtime_stats AS rs ON rs.plan_id = p.plan_id
JOIN sys.query_store_runtime_stats_interval AS i
ON i.runtime_stats_interval_id = rs.runtime_stats_interval_id
-- no execution_type filter, so timed-out and failed runs are included
WHERE i.start_time >= DATEADD(day, -@DaysBack, SYSUTCDATETIME())
AND CHARINDEX(PARSENAME(@Table, 1), qt.query_sql_text) > 0
AND CHARINDEX(N'query_store', qt.query_sql_text) = 0 -- skip this query itself
GROUP BY q.query_hash
)
SELECT TOP (20)
r.executions,
CONVERT(bigint, r.total_reads / r.executions) AS reads_per_exec,
t.table_pages,
CONVERT(decimal(12, 2), r.total_reads / r.executions / NULLIF(t.table_pages, 0)) AS reads_to_table_pages,
CONVERT(bigint, r.total_duration_us / r.executions / 1000) AS avg_ms,
r.sample_text
FROM Runs AS r
CROSS JOIN TablePages AS t
ORDER BY reads_to_table_pages DESC;Query Store's averages are per interval, so the query weights them by execution count. Two caveats. Key lookups and nested loops can push the ratio above 1, and columnstore reads appear as LOB reads, so for columnstore tables lean on the execution plan's segment counts instead. On the test table, the daily partition queries all grouped under one query hash, because the hash ignores literal values. Query Store also holds other applications' queries, so match the results against the Extended Events capture.
Why query folding breaks
If the date predicate is missing, the cause is almost always a Power Query step that sits before the date filter and that Power Query can't translate into SQL.
Converting the date column
The warehouse stores dates as integer keys like 20261101, incremental refresh insists on date/time parameters, so somebody converts the key to a date in Power Query and filters on the result. That conversion typically stops folding, so the date range never reaches SQL Server and every partition reads the whole table. The same cost turns up if the conversion lives in a SQL view instead, as a function wrapped around the column. Here's that version against a straight integer comparison, with an index on the key:
| Predicate | Reads | Time |
|---|---|---|
| Function on the key column (CONVERT in the WHERE clause) | 168,550 | 5.8 s |
| Compare the integer key to integer values | 44,541 | 28 ms |
The fix is to go the other way: convert RangeStart and RangeEnd into integers and compare those with the key. In M:
DateKey = (x as datetime) => Date.Year(x) * 10000 + Date.Month(x) * 100 + Date.Day(x),
Filtered = Table.SelectRows(Source,
each [SaleDateKey] >= DateKey(RangeStart) and [SaleDateKey] < DateKey(RangeEnd))Even better, if you own the schema, give Power BI a real datetime column to filter on. A persisted computed column does that without changing the load logic:
ALTER TABLE dbo.FactSales ADD SaleDateFromKey AS
CONVERT(datetime2(0), CONVERT(char(8), SaleDateKey), 112) PERSISTED;
CREATE INDEX IX_FactSales_SaleDateFromKey ON dbo.FactSales (SaleDateFromKey);That went from 5.8 seconds to under 30 ms in my test. Check every key is a valid date first, or the column will fail. Once it's indexed, anything that writes to the table needs the SET options that indexed computed columns require, including QUOTED_IDENTIFIER ON. SQL Agent job steps can run with that option off, so check any that load the table. (The 44,000 reads in the faster versions are key lookups on a non-covering index. Clustering on the column the refresh filters by, as below, removes them.)
Table.Buffer before the filter
Buffering loads the data into memory in Power Query, and nothing after it can fold. Ask whether one sits above the date filter.
A native SQL query as the source
If the source is a SQL statement rather than a table or view, later steps usually won't fold on top of it. The exception is Value.NativeQuery with the EnableFolding option switched on. Even then, keep it a plain SELECT, because Power Query wraps it in a subquery to add the date filter and T-SQL won't accept a WITH clause there. The other option is to build RangeStart and RangeEnd into the SQL text itself.
Merging with another source
Joining the fact table to a spreadsheet or a SharePoint list before filtering often forces Power Query to do the join itself. Filter the SQL table first, merge afterwards, or move the lookup data into SQL Server.
The filter isn't the first meaningful step
Custom columns, index columns and type changes don't all break folding, but each one is a chance to. The safest arrangement is source, date filter, then everything else.
Power BI Desktop does check this, and for SQL sources the check is reliable, but models change over time, so confirm it from the server side too. Microsoft's incremental refresh troubleshooting guide covers the Power BI side.
Making the bounded query cheap
Once the predicate is reaching SQL Server, the job is to make a one-day range cheap to read. For partition-sized reads that return every column, the boring answer won:
CREATE CLUSTERED INDEX CX_FactSales_SaleDate ON dbo.FactSales (SaleDate, FactSalesId);
Adding FactSalesId keeps the key unique when timestamps repeat, so declare it UNIQUE if it is. Changing the clustered index on a busy production table affects every other query and write against it. Treat this as the design for a table that mostly serves date-range loads. If you can't change it, a nonclustered index on the date column is the next option. But if the model imports every column, that index either needs a long INCLUDE list or pays for key lookups.
What about columnstore?
The columnstore index in the test skipped 19 of the 20 segments for the one-day query and was quick. It still needed 3,390 LOB page reads and 69 ms, against the rowstore's 98 reads and 4 ms. Columnstore is excellent for scans and aggregations across lots of rows. A refresh partition is a narrow slice that needs every column, and that suits a B-tree seek.
On SQL Server 2022 and later, an ordered columnstore (CREATE CLUSTERED COLUMNSTORE INDEX ... ORDER (SaleDate)) sorts the data by date, on a best-effort basis, as it builds the index. Here it made no difference, because the load had already written the rows in date order. It earns its keep when rows arrive out of date order. If the table already has to be columnstore for other reasons, it'll cope fine.
Supporting "Detect data changes"
If the team uses "Detect data changes", give them a proper audit column that whatever writes the row keeps up to date, plus an index that answers the MAX from a small range:
ALTER TABLE dbo.FactSales ADD LastModified datetime2(3) NOT NULL
CONSTRAINT DF_FactSales_LastModified DEFAULT SYSUTCDATETIME();
CREATE INDEX IX_FactSales_SaleDate_LastModified
ON dbo.FactSales (SaleDate, LastModified);The default only stamps new rows, so whatever updates the table has to set LastModified as well. It also has to be a different column from the one that drives the partitions. If the table is already clustered on the date, polling is cheap anyway: the index took the one-day MAX from 190 reads to 40. It matters more when the clustered index leads on something else.
Old changes, deletes and moving dates
A few sharp edges sit outside the refresh window.
Anything older than the refresh window is never read again by a normal scheduled refresh. A correction to last March's sales won't appear in the model until somebody refreshes that partition on purpose, which on Premium-type workspaces can be done for individual partitions through the XMLA endpoint.
Hard deletes only reach the model when Power BI reloads their partition. Outside the refresh window that never happens, and with "Detect data changes" on, a delete usually leaves the audit column's maximum unchanged, so its partition may be skipped. Change detection only notices soft deletes, where the row stays in the table with a deleted flag and a fresh audit timestamp.
Changing a row's partitioning date causes its own problem. Power BI treats it as a delete in one partition and an insert in another, and if the old partition is outside the refresh window, the "delete" never happens. This can lead to refresh failures caused by partition-key conflicts. If a business date can really change, partition on something that can't, such as the date the transaction was created.
Working with your BI team
This is the list I'd share, along with the Query Store output, so everyone's looking at the same numbers:
- Check the date range reaches SQL Server. View Native Query on the date filter step shows it, and a trace during a real refresh confirms it.
- Filter first. The RangeStart/RangeEnd filter goes straight after the source, with no Table.Buffer, merges or conversions of the date column above it.
- Use one inclusive boundary. Greater than or equal to RangeStart, less than RangeEnd. Both inclusive means duplicate rows at midnight.
- Plan republishes of incrementally refreshed models together, because each one triggers a full reload.
- Agree how you'll handle late changes and deletes before choosing the refresh window, rather than discovering it in a reconciliation.
Nearly everything on that list is Power Query knowledge. It's also the part of Power BI that's easiest to miss when you learn on the job. A model that doesn't fold still works fine on a laptop with a small date range. If your BI team is going through training, it's worth making sure the course covers Power Query, query folding and refresh properly rather than mostly visuals. Red Eagle Tech's guide to choosing Power BI training for your BI team covers what a solid course should include.
When incremental refresh isn't worth it
Some tables are better off without a refresh policy. If the whole table reloads in a few minutes, the extra moving parts probably aren't worth it. If large parts of history change all the time, the refresh window ends up covering almost everything and you've gained very little.
Hybrid tables can give near real-time figures, but they move part of the load to the working day as DirectQuery traffic, which brings back my last article's problems. If your organisation is heading towards Microsoft Fabric, SQL Server 2025 mirroring with Direct Lake reporting is another route. It swaps the morning scans for an initial snapshot and then a continuous read of the transaction log. That's a different load pattern rather than a free one, and a reseed can trigger another snapshot.
Three things to do this week
- Run the session query during your next morning refresh and see what Mashup Engine is actually sending.
- Run the Query Store ratio script against your biggest fact tables. Anything near 1.00 every morning is worth a conversation.
- Check that each fact table Power BI refreshes from has an index that leads on the column the refresh filters by.
If all three come back clean, the morning load is probably the real cost of the refresh, and the next conversation is about scheduling and capacity.