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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

REST api to issue DAX against dataset

Hi,

I tried to follow the exact same steps as described in the post below by MSFT and get the below error .Can someone please guide .

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

Note: I havent made any change in the PS script except the query/datasetID.I am logged into powerBI as "me" and see the error.

 

Error

Invoke-PowerBIRestMethod : One or more errors occurred.
At line:25 char:9
+ $result=Invoke-PowerBIRestMethod -Url $requestURL -Method Post -Body ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

4 REPLIES 4
lbendlin
Super User
Super User

Try a simple query first , EVALUATE a small table.

 

I had to completely uninstall all the Power BI Management cmdlets that have accumulated over the years and install the latest version.  you may want to do the same.

Anonymous
Not applicable

I tried a lot of things but i got a different error now and not sure of the reason.I was able to run dataset refresh and GET methods but unsuccessful with this "executing of DAX"

Error:

pBI1234_1-1631684249956.png

Error is constantly pointing to something wrong at the client end request and i am not sure what more to fix.

 

Here is my code:

DAX_question.png

I tried the same with refreshes endpoint as below and the service principal was able to refresh the dataset.

# refresh
$uri = "https://api.powerbi.com/v1.0/myorg/groups/$GroupId/datasets/$DatasetId/refreshes"
Invoke-RestMethod -Uri $uri –Headers $headers –Method POST –Verbose

 

Note: 

  • I also used -Headers in the executequeries rest api but it didnt make a difference
  • I registered an Azure app ,obtained the AppID,secretvalue,tenantID.I provided dataset.read and write permission for the app to call REST api.
  • I created an AAD security group and added the service principal account into it as a member.
  • Installed and imported all MicrosoftPowerBIMgmt modules in powershell
  • Service principal is granted Admin on the dataset it is trying to query.
  • Workspace is  V2 
  • Tried to Login-PowerBI to use my creds and query the dataset but i get the same error.

 

Anonymous
Not applicable

Thanks for your help.I already have a very simple evaluate query ,but I will definitely try to uninstall and reinstall the pbi cmdlets as you mention.

Anonymous
Not applicable

Hi @Anonymous 

I think you can refer to this post with similar issue like yours. Try to move your dataset into V2 workspace. This user solved his issue by this way.

For reference: New API Endpoint with DAX Queries

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.