0

I use 'Import' connectivity mode in Power Bi to get data from SQL server.
On the one hand, I can refresh the data for existing time periods. But on the other hand, once the data extended on server and new time periods are added, the new data with new periods doesn't appear in queries.

Should I use 'Live connection' only or there is another way to handle it?

1 Answers1

0

You can always set a scheduled refresh in Power BI to accomodate for different times of SQL DB updates.

You can also use Power BI REST APIs to do a 'Refresh Now' using

POST https://api.powerbi.com/v1.0/myorg/groups/{group_id}/datasets/{dataset_id}/refreshes

You can use this Powershell snippet:

# Building Rest API header with authorization token
$authHeader = @{
   'Content-Type'='application/json'
   'Authorization'=$token.CreateAuthorizationHeader()
}

# properly format groups path
$groupsPath = ""
if ($groupID -eq "me") {
    $groupsPath = "myorg"
} else {
    $groupsPath = "myorg/groups/$groupID"
}

# Refresh the dataset
$uri = "https://api.powerbi.com/v1.0/$groupsPath/datasets/$datasetID/refreshes"
Invoke-RestMethod -Uri $uri –Headers $authHeader –Method POST –Verbose

For more info, use Power BI docs: https://powerbi.microsoft.com/en-us/blog/announcing-data-refresh-apis-in-the-power-bi-service/

RBreuer
  • 1,371
  • 1
  • 7
  • 17