0 Kudos

Function that automatically adds Closing Parentheses not very smart

Status: Delivered
by jengwt Member ‎02-07-2019 08:43 AM - edited ‎02-07-2019 09:07 AM

When writing a measure earlier, I made a change and forgot to add a closing parenthesis. When I executed the change, DAX noticed the error and slapped a closing parenthesis onto the end of my code. Except, in this case, my code ended in a comment. Consequentially the code didn't run.

 

DumbAutoCloseParentheses.PNG
YES, I know it's as simple as me adding the closing parenthesis in the correct spot, moving my comment, or changing my comment to a block comment instead of a line commnet, but THAT'S NOT THE POINT. The point is that I've found a bug in this functionality, which appears to be that DAX automatically slaps closing paretheses onto the end of code, regardless of whether or not it makes any sense.

 

But that's not all. I've notice when you use the intellisense functionality to finish table or column calls, it has a habit of deleting closing parethises that follow what you're filling out. So you can extrapolate how, if you used the intellisense multiple times while editing a long DAX code, that DAX would slap those closing parentheses it chose to delete onto the end of your long code, thus breaking it. Actually, you don't have to extrapolate it, because I tried it earlier on some really long and nasty code, and ended up having half a dozen closing parentheses tacked on to the end of my code. It wouldn't fit reasonably on a screenshot, you'll just have to trust me.

 

So, I ask that this functionality be made a little smarter, please.

Status: Delivered
Comments
by Moderator v-yuezhe-msft
Monday

@jengwt,

DAX  will always slap a closing parenthesis onto the end of your code no matter if you have comments in the code.

It is not possible to automatically add the closing parenthesis into the right place where you need closing parenthesis . If you concern abput this behavior, I would recommend you submit a feature request in Power BI ideas forum.

Regards,
Lydia

by Moderator v-yuezhe-msft
Monday
Status changed to: Delivered
 
Idea Statuses