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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

SQL Server Direct Query not updating with embeded report.

We have a multi-tenant application that uploads reports, changes the datasources, and deploys the single report to the different tenants. 

 

For the import mode, everything works as expected and we are able to use the API to set a refresh schedule.

 

With the direct query mode, the uploaded report can be manually refreshed in the Power BI Service, however when it is embeded, the query never refreshes and only pulls down what is in the dataset. Here is the flow of getting the report to the server. Keep in mind, the gateways and datasources are manually created, we just attach the correct one at the upload time.

 

PbiClient created with the ServicePrincipalProfile for the workspace.

Imports.PostImportWithFileInGroup();

PbiClient created as Admin User.

Datasets.TakeOver(groupdId, datasetId); (Admin User required to bind to gateway)

Datasets.UpdateParameters(datasetId, UpdateMashupParametersRequest); (Server and DatabaseName parameters are built with the report in Power BI Desktop)

Datasets.BindToGateway(groupId, datasetId, BindToGatewayRequest); (The request has the correct gatewayId and datasourceId)

Datasets.RefreshDataset(groupId, datasetId, DatasetRefreshRequest);

DatasetRefreshRequest.NotifyOption = NoNotification;

DatasetRefreshRequest.ApplyRefreshPolicy = true; (I have tried omitting this, have not tried setting to false)

DatasetRefreshRequest.Type = Automatic; (I have tried the Full option as well)

DatasetRefreshRequest.EffectiveDate = DateTime.Now;

 

The refesh request works with the initial upload.

 

When I embed the report after it has been uploaded, the direct query report never re-runs the query.

 

I have also attempted to set a refresh schedule for direct query, this always returns Bad Request. I can successfully set a refresh schedule for Import Mode.

 

Any help would be appreciated.

 

 

 

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

 

With the direct query mode, the uploaded report can be manually refreshed in the Power BI Service, however when it is embeded, the query never refreshes 

 

 

Direct Query and refreshes are incompatible.  A Direct Query will run a query against the data source for every user interaction with the report visuals.   You cannot refresh a Direct Query data source programmatically.

 

There is additional complexity here if you have enabled query caching in the dataset settings.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

 

With the direct query mode, the uploaded report can be manually refreshed in the Power BI Service, however when it is embeded, the query never refreshes 

 

 

Direct Query and refreshes are incompatible.  A Direct Query will run a query against the data source for every user interaction with the report visuals.   You cannot refresh a Direct Query data source programmatically.

 

There is additional complexity here if you have enabled query caching in the dataset settings.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.