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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
garythomannCoGC
Impactful Individual
Impactful Individual

To hash or not to hash? step naming #"" versus PascalCase

power query m. change step names from #"name something" to NameSomething. Are there any issues around renaming to pascal case and removing the #"" wrapper?
The #"" wrapper gives me the heebee jeebees :}
Is there a valid reason to use the #"" wrapper for step naming?  I would prefer to rename all my steps to PascalCase meaningful names.
This may be my just needing to accept the #"" wrapper just like I did with TSQL all those years ago.  ie 'table'.[column]
Where now when writing TSQL I always use the '' table and [] column wrappers regardless if needed or not.

Thoughts?

AI response was that I needed the #"" wrapper for underscores but this has not been the situation for pqm I have written.
For example,  screen shots from recent post    
The key didn't match any rows in the table. Does data model table order matter?

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @garythomannCoGC ,

 

There's no reason you can't change the step names to avoid the #"" wrapper. I do it in all of my M code, albeit in camelCase, rather than PascalCase. It makes the code way easier to read, in my opinion, and allows you to see what's happening in the query at a glance from the step list.

For example, rather than 'Added Column' in the step list (#"Added Column" in code), I will explicitly name the step with with column was added, like 'addSalesRevenue' etc.

 

The reason the wrapper is added in the first place is that step names in M aren't just labels for the step, they're table names i.e. every step holds the recipe to form a particular/distinct table (by tracking back through the previous step arguments).

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

5 REPLIES 5
garythomannCoGC
Impactful Individual
Impactful Individual

Thanks guys,  much appreciated.  Nice ahha moment thinking about each step as a table of values.

And #table is part of the lexicon of the m language.

BA_Pete
Super User
Super User

Hi @garythomannCoGC ,

 

There's no reason you can't change the step names to avoid the #"" wrapper. I do it in all of my M code, albeit in camelCase, rather than PascalCase. It makes the code way easier to read, in my opinion, and allows you to see what's happening in the query at a glance from the step list.

For example, rather than 'Added Column' in the step list (#"Added Column" in code), I will explicitly name the step with with column was added, like 'addSalesRevenue' etc.

 

The reason the wrapper is added in the first place is that step names in M aren't just labels for the step, they're table names i.e. every step holds the recipe to form a particular/distinct table (by tracking back through the previous step arguments).

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




AndreasKiller
Regular Visitor

First, you need to understand that we're talking about MCode here, not the UI. Open the advanced editor and look at the MCode; that's what Power Query actually is.

 

All languages ​​have certain characters that you can't use in code. So, if you have a "Changed Type" step (with a space), then for Power Query, "Changed" and "Type" are two separate words. In order for it to be recognized as one word, something must be placed in front of it, hence the #.

 

"Change Type" without the # is a string in MCode.

 

let
Source = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Nr", type number}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Example", each if [Header]="Changed Type" then 1 else 0)
in
#"Added Custom"

That's it.

 

Andreas.

@AndreasKiller   thank you for your kind reply

Yes string literals are "string".  Maybe functions are in camel case  ie  myBeautFunction ()
And step names we make a rule as PascalCase.   I suppose I am asking for MCode naming conventions.
To me PascalCase for the step names makes for an easier code read.
And yes I do understand that #"" wrapping is for spaces, prefix numbers and special characters.  But avoiding those we can have beautiful code :}
Or am I missing something?  Maybe in the MCode road map #"" for step names is a mandatory requirement.

let
    Source = Excel.CurrentWorkbook(){[Name = "Tabelle1"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source, {{"Nr", type number}}),
    AddedCustom = Table.AddColumn(
        ChangedType,
        "Example",
        each if [Header] = "Changed Type" then 1 else 0
    )
in
    AddedCustom

 

Also why does MCode always start with the first step called Source and not #"Source" !?
I am sure I was not the only one to be confused when first starting with MCode :}

The Source step does not need the # because Source does not conatin a blank...

 

If a step contains a blank you get

#"Sour ce"

otherwise you get

Source

 

The same is for any other step

#"Changed Type"

versus

ChangedType

 

So if you record MCode using the UI and you want to remove the # step names, rename each step in the UI and remove the blanks.

 

Andreas.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors