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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RaphaelV
Frequent Visitor

Power Query AddColumn synthax error : Power BI API

Hello community !

I am trying to execute a AddColumn query on a dataset with Power BI API method Datasets - Execute Queries, and always get an error in return.

Here is the request body :

 

{
"queries": [
{
"query": "Table.AddColumn("test","delay_creation_endOfMonth",each Duration.Days(Date.EndOfMonth(#datetime(2021,11,11,5,0,0)) - [date_creation]))"
}
],
"serializerSettings": {
"includeNulls": true
}
}

And here is the response :

 

{
"error": {
"code": "BadRequest",
"message": "Bad Request",
"details": [
{
"message": "After parsing a value an unexpected character was encountered: t. Path 'queries[0].query', line 4, position 33.",
"target": "request.queries[0].query"
},
{
"message": "'request' is a required parameter",
"target": "request"
}
]
}
}

As I saw in this post : Solved: Power BI Rest API -- Datasets - Execute Queries-- ... - Microsoft Power BI Community , I think that the issue is due to double quotes "
However, when I tried to put / (or \ ) in front of the doubles quotes " , I get an other error :

 

"message": "Query (1, 1) The syntax for 'Table' is incorrect. (Table.AddColumn(\"test\",\"delay_creation_endOfMonth\",each Duration.Days(Date.EndOfMonth(#datetime(2021,11,11,5,0,0)) - [date_creation]))).",

I also tried simple quotes ' , with no better result

Do you have any solution ?
Thank you !

1 ACCEPTED SOLUTION

Not that I'm aware of but I have very little experience with the API personally.

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

The documentation linked in that post is about DAX queries.

 

Table.AddColumn is not a DAX function but an M function.

Ooh ok, I thought they where the same thing
Is there a way to call an M function with Power BI API ?

Not that I'm aware of but I have very little experience with the API personally.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors