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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mfaircloth
New Member

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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