Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
In Power BI (Power Query), I tried to rename a column and ran into a strange issue.
When I rename the column to Week#(2) , the automatically generated M code is:
Renamed Columns2 =Table.RenameColumns(#"Expanded Maxim",{{"Week#.1", "Week#(#)(2)"}})
Later, when I write a new step and try to reference this column, I always get an “invalid identifier” error, no matter which name I use:
[Week#(2)]
[Week#(#)(2)]
Both give me an error.
Why is Power Query changing the name to Week#(#)(2) internally?
How am I supposed to correctly reference this column in later steps?
Is there something special about the # character or the parentheses in column names in Power Query / M?
Thanks in advance for any explanation or workaround!
Hi @T1moris,
Thank you for reaching out to the Microsoft Fabric Forum Community, and special thanks to @cengizhanarslan , @ralf_anton , @ronrsnfld and @Omid_Motamedise for prompt and helpful responses.
Just following up to see if the Response provided by community members were helpful in addressing the issue. if the issue still persists Feel free to reach out if you need any further clarification or assistance.
Best regards,
Prasanna Kumar
Hi @T1moris
Power Query has two different concepts:
Display name (what you see in the UI) => Week#(2)
M language identifier (what the engine must use internally)
M has strict identifier rules. A column name can be referenced directly only if it: Starts with a letter or underscore and Contains only letters, numbers, and underscores
Your column name: Week#(2) violates three rules: # is special in M ( and ) are not allowed in identifiers
In M: #"Some Text" means “treat this text literally as a name” So when Power Query internally generates: "Week#(#)(2)"
The column name contains literal text Week#(2), and the # itself must be escaped This is not a rename mistake—it’s Power Query protecting itself from syntax errors.
Why do [Week#(2)] and [Week#(#)(2)] both fail?
Because square brackets only work for valid identifiers. This works: [SalesAmount] and This fails: [Week#(2)]
Because Week#(2) is not a valid identifier, even if that looks like the column name.
The CORRECT way to reference this column is: [#"Week#(2)"]
Because you have "special" characters within your new name, and even nested special characters, you need to escape those characters:
#"Week#(#)(2)"
Example:
Hallo,
wenn Du Sonderzeichen in den Spaltennamen benutzt, müssen diese bei der Auswertung mit #"..." maskiert werden. Beispiel:
#"Umbenannte Spalten" = Table.RenameColumns(Quelle,{{"Woche 2", "Woche #(#)(2)"}}),
wert = #"Umbenannte Spalten"[#"Woche #(#)(2)"]{0}
Im Prinzip analog zur Verwendung bei Abfrageschrittnamen mit Sonder- oder Leerzeichen.
Besser ist es daher, auf Sonder- und Leerzeichen zu verzichten.
# and parentheses are the issue, and what you’re seeing is Power Query trying to “escape” characters that have meaning in M.
In M, #(...) is used in special literals (like #date(2025,1,1) or #duration(...)).
So when you put #( inside a column name (Week#(2)), the rename UI tries to escape it and you end up with the weird internal text Week#(#)(2).
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!