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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Group By's "All Rows" does not quote columns identifiers, throwing "Syntax Error:Invalid identifier"

As the title says, when performing a Group By operation using the All Rows aggregate, Power Query does not quote column identifiers which contain invalid characters other than spaces (in my case it was parentheses).

 

This results in an Expression.SyntaxError error due to invalid identifiers being referenced by the automatically generated query step.

 

Here is an excerpt from the Group By step. You can see that the two columns were not escaped automatically, leading to a Syntax Error.

= Table.Group(#"Changed Type", {"FIN.TRANSACTION REFERENCE NUMBER"}, {{"Count", each Table.RowCount(_), type number}, {"Data", each _, type table [MCH.MERCHANT CATEGORY CODE (MCC)=text, ACC.ACCOUNT GROUP NAME(S)=text, /* other columns, removed for tidyness */]}})

Here is my adjusted code, which works:

= Table.Group(#"Changed Type", {"FIN.TRANSACTION REFERENCE NUMBER"}, {{"Count", each Table.RowCount(_), type number}, {"Data", each _, type table [#"MCH.MERCHANT CATEGORY CODE (MCC)"=text, #"ACC.ACCOUNT GROUP NAME(S)"=text, /* other columns, removed for tidyness */]}})

I don't know what is the parsing logic for automatically escaping column names, but it is evidently missing this perticular case.

 

Thanks!

GL

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

I'm on the May 2019 version, and try to make a small table with the same name as you refer on your post and the grouping got done without any errors, making automatically the expression similar to your second expression.

 

What is the version you are using and how did you make the group by? Did you write the code or did you use the grouping option?

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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