cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: Incompatibility in Comments Between Power BI Desktop and Power BI Dataflows

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 //:

02.png

 

The second one uses a one-line comment with /**/:

03.png

And the last one contains a multiline comment with /**/:

04.png

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.)

05.png

 

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.

6.png

 

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.

7.png

 

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.

8.png

 

Status: New
Comments
Microsoft

Thank you for the bug report.

 

Yes, this appears to be an issue with the way Power Query Online rewrites user queries (which is something that isn't done in Power BI Desktop / Excel). It looks like it currently doesn't support multiline block comments properly. We've filed a bug internally to resolve this issue. 

 

As a workaround in the meantime, you could use single line comments (//). Note that you can use a keyboard shortcut (Ctrl+/) to toggle line comments for the currently selected lines. This allows you to quickly comment out multiple lines without using block comments (/* */).