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.
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
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |