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
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.

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
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.