Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Novox
Regular Visitor

Why does every refresh in PBI download 4096 rows from every data table?

I'm tracing my PBI queries against my SQL server and for the life of me, I can't tell why it downloads top 4096 rows from every included data table, only to perform my actual query moments later?

 

i.e.

This SQL:BatchCompleted happens:

select top 4096
    [$Ordered].[Id],
    [$Ordered].[CenterId],
    [$Ordered].[BusinessDate],
    [$Ordered].[IDCash],
    [$Ordered].[CashDrawerName],
    [$Ordered].[OpenTime],
    [$Ordered].[OpenUser],
    [$Ordered].[CloseTime],
    [$Ordered].[CloseUser],
    [$Ordered].[ReportAmount],
    [$Ordered].[Shift_Id]
from 
(
    select [Id],
        [CenterId],
        [BusinessDate],
        [IDCash],
        [CashDrawerName],
        [OpenTime],
        [OpenUser],
        [CloseTime],
        [CloseUser],
        [ReportAmount],
        [Shift_Id]
    from [dbo].[CashTurns] as [$Table]
) as [$Ordered]
order by [$Ordered].[Id]

Then a few events later, I see my actual query, SQL:BatchCompleted:

execute sp_executesql N'select [_].[Id] as [Id],
[_].[CenterId] as [CenterId],
[_].[BusinessDate] as [BusinessDate],
[_].[IDCash] as [IDCash],
[_].[CashDrawerName] as [Drawer Name],
[_].[OpenTime] as [Open Time],
[_].[OpenUser] as [Open User],
[_].[CloseTime] as [Close Time],
[_].[CloseUser] as [Close User],
[_].[ReportAmount] as [Amount],
[_].[Shift_Id] as [Shift_Id]
from
(
select [Id],
[CenterId],
[BusinessDate],
[IDCash],
[CashDrawerName],
[OpenTime],
[OpenUser],
[CloseTime],
[CloseUser],
[ReportAmount],
[Shift_Id]
from [dbo].[CashTurns] as [$Table]
) as [_]
where [_].[BusinessDate] = convert(datetime2, ''2018-06-04 00:00:00'') and [_].[CenterId] = 2'
8 REPLIES 8
Anonymous
Not applicable

Can you check whether you have given Keep Top Rows as 4096 in Query Editor?

 

Check this in Query Editor -> Home Tab -> Keep Rows-> Keep Top Rows.  If any values mentioned theer, remove that and check again.

 

Thanks
Raj

I have no "Keep Rows" in my query (well, when clicked from the Query ribbon).

 

For all data tables (this is SQL BTW), I have some:

 

"Remove Columns"

"Renamed Columns"

 

and an advanced filter (which I guess is technically a "Keep rows...") with two simple equality comparisons, neither are "top."

Stachu
Community Champion
Community Champion

could that be preview that PowerBI generates when editing the queries? If so maybe disabling background previews download would help.
or does that happen during regular refresh?



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Background refresh is off, and this happens for every refresh (or initial load from a template).  My SQL server is unnecessarily interrogated for > 4000 rows, for every table, just prior to performing the actual query, which seems quote incorrect...

Novox
Regular Visitor

I tried recreating the issue by slowly rebuilding my report.

 

When I add a filter on a date or date/time column with a literal value, it works as expected.

 

When I instead use a date or date/time parameter as the value for the filter on my date or date/time column, it ALWAYS retrieves 4096 rows, then actually performs the query.

 

I tried the same thing with a Decimal (int) type filter/parameter combination and there were no issues.  It immediately queried the correct number of rows (not first 4906)...

Anonymous
Not applicable

Good catch Novox.  am interetsed to understand why parameter on date behaves this way...

 

Thanks

Raj

Novox
Regular Visitor

I believe this is an actual Issue.  Further commentary will be at http://community.powerbi.com/t5/Issues/Using-a-date-or-date-time-parameter-as-a-filter-always-result...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.