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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.

Top Kudoed Authors