Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I am excited about the online Power Query Advanced Editor which is used e.g. in Power BI Dataflows. But I have found out that there are some differences in comparison to Power Query Advanced Editor in Power BI Desktop. In Power BI Dataflows, Power Query Advanced Editor supports multiline comments /**/ but the engine itself does not. Let me explain you what I mean.
I created 3 queries in the Power BI Desktop’s Power Query Editor:
The first one contains also a one-line comment starting with //:
The second one uses a one-line comment with /**/:
And the last one contains a multiline comment with /**/:
As next, I selected all of them in Power Query Editor, right clicked, and copied the M code of all three queries. (You can also copy just one after each other or you can even select a group of queries and copy all of them at once. It is a very nice feature.)
And you get:
// Table one-line //
let
// comment 1
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkvMKU01VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
// comment 2
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}})
in
#"Changed Type"
// Table one-line /**/
let
// comment 1
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkvMKU01VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
/* comment 2 */
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}})
in
#"Changed Type"
// Table multiline /**/
let
// comment 1
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkvMKU01VIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
/*
* comment 2
* next line
*/
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}})
in
#"Changed Type"
Then I created a new Power BI Dataflow with a blank query, pasted the first of the three queries, and clicked on Next. It worked fine. The same for the second one. But then I created the last query with the multiline comment.
The syntax highlighter does its job, the multiline comment is there, everything looks great, right? But only until you click on the button Next. I got a syntax error saying that a token identifier is expected and not an asterisk.
I opened the code again and, as you can see on the next screenshot, the problem is that my code was modified by the advanced editor. It replaced /*<carriage return>* with just // *. That works just for the first line but does not for the others.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.