web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Issues with PowerBI Execute Dataset Query

(0) ShareShare
ReportReport
Posted on by

Attached to the PowerBI datasource is a method called ExecuteDatasetQuery that appears to be for submitting DAX queries to a PBI dataset.  I've burned an entire day trying to understand how this thing is supposed to work and your documentation is... lacking.  At any rate, I can't get a single query (that otherwise functions everywhere else DAX queries can be executed) to return something meaningful within PowerApps.

 

Any query, even something as simple as 

 

EVALUATE(MyTable)

 

returns the following:

2022-08-23_17-10-44.png

I can CountRows on the result of running

 

ClearCollect(_result,PowerBI.ExecuteDatasetQuery(workspaceGUID,datasetGUID,queryString));

 

and see exactly the number of rows I'd expect to see when running this query anywhere else, but the collection itself has no columns and now values.

 

Any help?

 

P.S., I'd love to do this in Power Automate, since that's a much nicer way to set these things up but y'all don't appear super invested in making that useful so...

I have the same question (0)
  • tgayle Profile Picture
    2 on at
    Re: Issues with PowerBI Execute Dataset Query

    I am having the issue which this function. Any solution yet?

  • darkramuh Profile Picture
    11 on at
    Re: Issues with PowerBI Execute Dataset Query

    Same here, would like to know the solution

  • Community Power Platform Member Profile Picture
    on at
    Re: Issues with PowerBI Execute Dataset Query

    Same here... anyone?

  • jefmeyer Profile Picture
    166 on at
    Re: Issues with PowerBI Execute Dataset Query

    I'm having the same results.  Any luck getting this working?

  • PowerFoe Profile Picture
    4 on at
    Re: Issues with PowerBI Execute Dataset Query

    If anyone else is trying this, check out this post on Reddit here. 

  • boi5st0 Profile Picture
    21 on at
    Re: Issues with PowerBI Execute Dataset Query

    Try this out.  For me its working.

    Set(Result,PowerBI.ExecuteDatasetQuery("XXXXXXX","XXXXXXX","EVALUATE GetAllCustomerCounts").firstTableRows);

    ClearCollect(
    colCustomer,
    ForAll
    (
    Result,
    {
    Customer: Text(Value.'GetAllCustomerCounts[customer]'),
    Count: Text(Value.'GetAllCustomerCounts[count]')
    }
    )
    );
  • goreavin Profile Picture
    13 on at
    Re: Issues with PowerBI Execute Dataset Query

    Hi @boi5st0,

     

    Thank you!

     

    Is there a way to debug the outputs that are in Result variable? How did you arrive at this approach?

     

    Also, there is a PowerBI.ExecuteDatasetQueryJson function. Do you know if this one is a bit easier to handle?

    Best,

    Avi

    Best, Avi

  • MikeB31107 Profile Picture
    3 on at
    Re: Issues with PowerBI Execute Dataset Query
    This is it..! Took a lot of digging, works for me too - thanks!
  • SergiP Profile Picture
    118 on at
    Re: Issues with PowerBI Execute Dataset Query

    Thank you! It was exactly what I needed to make it work.

    Now I'm able to get the info from PBI into PowerApps but I found that it only works for me. When any other user uses the PowerApp there's an error when launching the PowerBI.ExecuteDatasetQuery. It looks like an authorisation problem:

    PowerBI.ExecuteDatasetQuery : {"error":{"code":401,"source":"europe-002.azure-apim.net","clientRequestId":"5a1d25a0-8d61-4ba0-9ade-2218fcef106f","message":"The response is not in a JSON format.","innerError":"Cannot read server response."}}

    I checked and the other users have no problem to access the Dataset from PBI, so they do have credentials...

    I tried with a Flow and it works when I set it up to use my connection (on the Run Only Permissions) instead of the "Provided by Run Only user".

     

    But I'd like to avoid using an external flow and use PowerBI.ExecuteDatasetQuery directly from PowerApps.

    Does anyone know how to deal with the permissions with multiple users?

    regards

     

  • clbamford Profile Picture
    11 on at
    Issues with PowerBI Execute Dataset Query
    Bumping this thread because I'm still encountering the same issue as @SergiP over a year later.

    Has anyone discovered a solution to permissions issues associated with running PowerBI.ExecuteDatasetQuery from directly within Power Apps?

    My users also encounter this error despite having build permissions to both the PBI semantic model I'm referencing and the associated report.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 624 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 381 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 225

Last 30 days Overall leaderboard