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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
weiyu_chen
Frequent Visitor

What is the escape char for rest api execute queries in postman

POST Body:

{
"queries": [
{"query": "EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=\"Completed\"), [Priority])"
}
],
"serializerSettings": {
"includeNulls": true
}
}
 
Got this error in Response:
{
"error": {
"statusCode": 0,
"errorCode": "QueryUserError",
"message": "Query (1, 1) The expression specified in the query is not a valid table expression.",
"errorDetails": [
{
"code": "AnalysisServicesErrorCode",
"detail": {
"type": 1,
"value": "3241803862"
}
}
]
}
}
 
Basically, this is my query: 
EVALUATE COUNTAX(FILTER('Activity',[Activity Status]="Completed"), [Priority])
How do I escape the '"' inside the body of the request. Is it '\', or something else? Thanks!
 
 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @weiyu_chen ,

I checked some of the relevant restrictions and it seems that none of them are touched on your side...

  1. Only 1 DAX query can be executed per REST API request.
  2. Each DAX query can have only 1 result set.
  3. Result sets are capped at 100k rows.
  4. Supported data types: string, numeric, boolean, blank, datetime and variant. Binary is not supported.
  5. Azure AS and SSAS do not support this DAX REST API.

Is it possible that the error is reported because this DAX Query returned a single value, but the required return result here is a table? Change the DAX Query to the following form and see if it works:

{
"query": "EVALUATE SUMMARIZE (
    'Activity',
    \"countofpriority\", COUNTAX ( FILTER ( 'Activity', [Activity Status] = \"Completed\" ), [Priority] )
)"
}

Best Regards

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @weiyu_chen ,

According to this official blog, its escape character is a backslash (\”). So I think your initial writeup should be correct...


@weiyu_chen wrote:

POST Body:

{
"queries": [
{"query": "EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=\"Completed\"), [Priority])"
}
],
....

yingyinr_0-1632303046912.png

Please check if you enable Allow XMLA endpoints and Analyze in Excel with on-premises datasets under the tenant-level setting tab in the Power BI admin portal. Besides that, you need the Build permission for the dataset if you want to query by using this new REST API.

yingyinr_1-1632303070490.png

yingyinr_2-1632303100260.png

Best Regards

@Anonymous Thanks for the reply. Yes, I have enabled XMLA:

Screen Shot 2021-09-22 at 8.34.18 AM.png

Also I am the owner of the dataset. I can access it. The problem is within FILTER function, I have this issue. But in the following query in SUMMERIZE function, it's OK:

{
"queries": [
{"query": "EVALUATE SUMMARIZE(Account, Account[Owner], \"Total\", SUM(Account[Annual Revenue]))"
}
],
"serializerSettings": {
"includeNulls": true
}
}
This query runs fine and return correct resultset.
Thanks!
Anonymous
Not applicable

Hi @weiyu_chen ,

I checked some of the relevant restrictions and it seems that none of them are touched on your side...

  1. Only 1 DAX query can be executed per REST API request.
  2. Each DAX query can have only 1 result set.
  3. Result sets are capped at 100k rows.
  4. Supported data types: string, numeric, boolean, blank, datetime and variant. Binary is not supported.
  5. Azure AS and SSAS do not support this DAX REST API.

Is it possible that the error is reported because this DAX Query returned a single value, but the required return result here is a table? Change the DAX Query to the following form and see if it works:

{
"query": "EVALUATE SUMMARIZE (
    'Activity',
    \"countofpriority\", COUNTAX ( FILTER ( 'Activity', [Activity Status] = \"Completed\" ), [Priority] )
)"
}

Best Regards

@Anonymous Thanks a lot for the solution.

weiyu_chen
Frequent Visitor

@lbendlin 

Thanks for the reply. I have tried your suggestion, get the following error:

{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "After parsing a value an unexpected character was encountered: \". Path 'queries[0].query', line 3, position 69.",
"target": "request.queries[0].query"
},
{
"message": "'request' is a required parameter",
"target": "request"
}
]
}
}
 
The query body is:
{
"queries": [
{"query": "EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=""Completed""), [Priority])"
}
],
"serializerSettings": {
"includeNulls": true
}
}
 
Thanks!
lbendlin
Super User
Super User

You can try

 

"query""EVALUATE COUNTAX(FILTER('Activity',[Activity Status]=""Completed""), [Priority])"

@lbendlin 

Also tried: 

"query": "EVALUATE COUNTAX(FILTER('Activity',[Activity Status]='"'Completed'"'), [Priority])"
get the error:
{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "After parsing a value an unexpected character was encountered: '. Path 'queries[0].query', line 3, position 70.",
"target": "request.queries[0].query"
},
{
"message": "'request' is a required parameter",
"target": "request"
}
]
}
}
Thanks!
Weiyu

Can you confirm that your original query runs in DAX Studio?

@lbendlin I have run the following query (measurement) in Power BI desktop without any issue:

Subcategory Cound = COUNTAX(FILTER(ProductSubcategory,[ProductSubcategory] = "Fans"),[ProductSubcategoryKey])

Thanks!

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.