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
Mgrike
Frequent Visitor

Error pulling data from the PowerBI API

Hi

 

I want to schedule a workflow that appends data to my PowerBI dataset, by first taking the max date in the dataset, and then appending the results for every day after that to my dataset.

 

I'm currently struggling to read the data in the PowerBI dataset.

 

I've tried following this guide:

https://powerbi.microsoft.com/en-us/blog/announcing-the-public-preview-of-power-bi-rest-api-support-...

 

but that wasn't working for me. What I'm currently trying is this (in PowerShell)

 

$requestUrl = "https://app.powerbi.com/groups/{Workspace ID}/datasets/{Dataset ID}/executeQueries"

 

$requestBody = @"
{"queries" : [ {"query" : "MAXX('WaitTimes', 'WaitTimes'[UpdatedDate])"} ] , "serializerSettings" : {"includeNulls": true} }

"@
Connect-PowerBIServiceAccount
$result = Invoke-PowerBIRestMethod -Method Post -Url $requestUrl -Body $requestBody

 

This code doesn't error, but it is returning a HTML document and not what I need. Does anyone have any advice?

 

Thanks

1 REPLY 1
lbendlin
Super User
Super User

You need to return a table. Your code is missing the EVALUATE statement.

 

NOTE: Power BI has no memory. You cannot append data to a regular dataset. Either use a push dataset, or use incremental refresh on a regular dataset.

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.