<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PowerBI API - Execute Queries on Dataset - Problem with DAX Statement in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3357586#M43679</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/594982"&gt;@RubenSchilling&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, AVERAGE() should be an aggregation function which will return&amp;nbsp;aggregated value instead of a table.&lt;/P&gt;
&lt;P&gt;Datasets - Execute Queries Rest API will return data as a table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_0-1690794969267.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/948981iBA8A368DBC33B5DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_0-1690794969267.png" alt="vrzhoumsft_0-1690794969267.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So Power BI will return error.&lt;/P&gt;
&lt;P&gt;You may refer to this &lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries#code-try-0" target="_self"&gt;offical blog&lt;/A&gt; to learn more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jul 2023 09:17:41 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-31T09:17:41Z</dc:date>
    <item>
      <title>PowerBI API - Execute Queries on Dataset - Problem with DAX Statement</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3353599#M43648</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;i am not able to execute any queries via the Execute query REST API, except when i ONLY use evaluate.&lt;/P&gt;&lt;P&gt;As you can see this one works without problem:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"queries": [&lt;BR /&gt;{&lt;BR /&gt;"query": "EVALUATE VALUES(Manufacturer)"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"serializerSettings": {&lt;BR /&gt;"includeNulls": true&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;RESULT:&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;{&lt;BR /&gt;"results": [&lt;BR /&gt;{&lt;BR /&gt;"tables": [&lt;BR /&gt;{&lt;BR /&gt;"rows": [&lt;BR /&gt;{&lt;BR /&gt;"Manufacturer[ManufacturerID]": 6,&lt;BR /&gt;"Manufacturer[Manufacturer]": "Leo",&lt;BR /&gt;"Manufacturer[MfgisVanArsdel]": "No"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when i literally use any other query like this:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"queries": [&lt;BR /&gt;{&lt;BR /&gt;"query": "AVERAGE(Sentiment[Score])"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"serializerSettings": {&lt;BR /&gt;"includeNulls": true&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The Result usually shows something like:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"error": {&lt;BR /&gt;"code": "DatasetExecuteQueriesError",&lt;BR /&gt;"pbi.error": {&lt;BR /&gt;"code": "DatasetExecuteQueriesError",&lt;BR /&gt;"parameters": {},&lt;BR /&gt;"details": [&lt;BR /&gt;{&lt;BR /&gt;"code": "DetailsMessage",&lt;BR /&gt;"detail": {&lt;BR /&gt;"type": 1,&lt;BR /&gt;"value": "Query (1, 1) The syntax for 'AVERAGE' is incorrect. (AVERAGE(Sentiment[Score]))."&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"code": "AnalysisServicesErrorCode",&lt;BR /&gt;"detail": {&lt;BR /&gt;"type": 1,&lt;BR /&gt;"value": "3238920194"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;I would appreciate any kind of help or hint in what i am doing wrong, or if certain statemeent s are just not supported within the API etc.&lt;/P&gt;&lt;P&gt;BR Ruben&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 14:45:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3353599#M43648</guid>
      <dc:creator>RubenSchilling</dc:creator>
      <dc:date>2023-07-27T14:45:41Z</dc:date>
    </item>
    <item>
      <title>REST API - Execute Queries not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3353260#M43688</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am not able to execute any queries via the Execute query REST API, except when i ONLY use evaluate.&lt;/P&gt;&lt;P&gt;As you can see this one works without problem:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"queries": [&lt;BR /&gt;{&lt;BR /&gt;"query": "EVALUATE VALUES(Manufacturer)"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"serializerSettings": {&lt;BR /&gt;"includeNulls": true&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RESULT:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;{
  &lt;SPAN class=""&gt;"results"&lt;/SPAN&gt;: [
    {
      &lt;SPAN class=""&gt;"tables"&lt;/SPAN&gt;: [
        {
          &lt;SPAN class=""&gt;"rows"&lt;/SPAN&gt;: [
            {
              &lt;SPAN class=""&gt;"Manufacturer[ManufacturerID]"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;6&lt;/SPAN&gt;,
              &lt;SPAN class=""&gt;"Manufacturer[Manufacturer]"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"Leo"&lt;/SPAN&gt;,
              &lt;SPAN class=""&gt;"Manufacturer[MfgisVanArsdel]"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"No"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when i literally use any other query like this:&lt;/P&gt;&lt;PRE&gt;{&lt;BR /&gt;"queries": [&lt;BR /&gt;{&lt;BR /&gt;"query": "AVERAGE(Sentiment[Score])"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"serializerSettings": {&lt;BR /&gt;"includeNulls": true&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Result usually shows something like:&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="4"&gt;&lt;SPAN&gt;{
  &lt;SPAN class=""&gt;"error"&lt;/SPAN&gt;: {
    &lt;SPAN class=""&gt;"code"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"DatasetExecuteQueriesError"&lt;/SPAN&gt;,
    &lt;SPAN class=""&gt;"pbi.error"&lt;/SPAN&gt;: {
      &lt;SPAN class=""&gt;"code"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"DatasetExecuteQueriesError"&lt;/SPAN&gt;,
      &lt;SPAN class=""&gt;"parameters"&lt;/SPAN&gt;: {},
      &lt;SPAN class=""&gt;"details"&lt;/SPAN&gt;: [
        {
          &lt;SPAN class=""&gt;"code"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"DetailsMessage"&lt;/SPAN&gt;,
          &lt;SPAN class=""&gt;"detail"&lt;/SPAN&gt;: {
            &lt;SPAN class=""&gt;"type"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;1&lt;/SPAN&gt;,
            &lt;SPAN class=""&gt;"value"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"Query (1, 1) The syntax for 'AVERAGE' is incorrect. (AVERAGE(Sentiment[Score]))."&lt;/SPAN&gt;
          }
        },
        {
          &lt;SPAN class=""&gt;"code"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"AnalysisServicesErrorCode"&lt;/SPAN&gt;,
          &lt;SPAN class=""&gt;"detail"&lt;/SPAN&gt;: {
            &lt;SPAN class=""&gt;"type"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;1&lt;/SPAN&gt;,
            &lt;SPAN class=""&gt;"value"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"3238920194"&lt;/SPAN&gt;
          }
        }
      ]
    }
  }
}&lt;BR /&gt;&lt;BR /&gt;I would appreciate any kind of help or hint in what i am doing wrong, or if certain statemeent s are just not supported within the API etc.&lt;BR /&gt;&lt;BR /&gt;BR Ruben&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Jul 2023 12:25:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3353260#M43688</guid>
      <dc:creator>RubenSchilling</dc:creator>
      <dc:date>2023-07-27T12:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Execute Queries not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3356321#M43689</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/594982"&gt;@RubenSchilling&lt;/a&gt;&amp;nbsp;Whether it is REST API, Power BI Desktop, Service, SSAS, Azure, DAX can be only queried by external tools using EVALUATE, that's what initiates the command.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 10:07:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3356321#M43689</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2023-07-29T10:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBI API - Execute Queries on Dataset - Problem with DAX Statement</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3357586#M43679</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/594982"&gt;@RubenSchilling&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, AVERAGE() should be an aggregation function which will return&amp;nbsp;aggregated value instead of a table.&lt;/P&gt;
&lt;P&gt;Datasets - Execute Queries Rest API will return data as a table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_0-1690794969267.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/948981iBA8A368DBC33B5DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_0-1690794969267.png" alt="vrzhoumsft_0-1690794969267.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So Power BI will return error.&lt;/P&gt;
&lt;P&gt;You may refer to this &lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries#code-try-0" target="_self"&gt;offical blog&lt;/A&gt; to learn more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 09:17:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3357586#M43679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-31T09:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: REST API - Execute Queries not working as expected</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3380949#M43902</link>
      <description>&lt;P&gt;Based on the information you provided, it seems like there might be an issue with the syntax of the query you are using with the Execute Query &lt;A href="https://tech-stack.com/blog/what-is-an-api/" target="_self"&gt;REST API&lt;/A&gt;. The error message indicates that the syntax for the 'AVERAGE' function is incorrect.&lt;/P&gt;&lt;P&gt;The issue is likely related to the fact that the 'AVERAGE' function requires a table as an argument, not just a column name. In DAX (Data Analysis Expressions), which is the language used in Power BI for calculations, the 'AVERAGE' function needs to be used in combination with the 'SUMMARIZE' or 'FILTER' function to define the table from which the average should be calculated.&lt;/P&gt;&lt;P&gt;Here's an example of how you can modify your query to calculate the average of the 'Score' column in the 'Sentiment' table using the 'SUMMARIZE' function:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"queries": [&lt;BR /&gt;{&lt;BR /&gt;"query": "EVALUATE SUMMARIZE(Sentiment, \"Average Score\", AVERAGE(Sentiment[Score]))"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"serializerSettings": {&lt;BR /&gt;"includeNulls": true&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;In this query, we use the 'SUMMARIZE' function to create a new table that groups the data by the 'Sentiment' table and calculates the average of the 'Score' column. The result will include a new table with one column named "Average Score" containing the average value.&lt;/P&gt;&lt;P&gt;Remember to adjust the query according to your specific data model and the tables/columns you want to use.&lt;/P&gt;&lt;P&gt;If you need to perform more complex calculations or filtering, you can use other DAX functions like 'CALCULATETABLE', 'FILTER', 'ALL', etc., to manipulate the data before calculating the average.&lt;/P&gt;&lt;P&gt;If you continue to face issues, ensure that your data model is correctly set up in Power BI and that the column names and table names you are using in the DAX queries are correct.&lt;/P&gt;&lt;P&gt;If you're using the Execute Query REST API with a different tool or language, make sure to check the documentation and examples provided by the API to ensure you are using it correctly with your specific setup.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 15:34:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3380949#M43902</guid>
      <dc:creator>ronaldhiggins</dc:creator>
      <dc:date>2023-08-15T15:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: PowerBI API - Execute Queries on Dataset - Problem with DAX Statement</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3403775#M44139</link>
      <description>&lt;P&gt;In the query text before any " will be used You need to add \. At list this worked for me in Azure Data Factory - spent some time on this also ...&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"query": "HERE !!!! "&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 08:01:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/PowerBI-API-Execute-Queries-on-Dataset-Problem-with-DAX/m-p/3403775#M44139</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-29T08:01:37Z</dc:date>
    </item>
  </channel>
</rss>

