March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
While importing data I'm using MS SQL Server query. Few columns in the data have reserved key words in them for eg. [Opportunity Close Date]. Such columns can be addressed properly in SQL server by putting them in square brackets but PowerBI keeps throwing error, "Invalid Coumn name 'Opportunity Close Date'". I have tried writing such column names:
1) Using square brackets
2) In double quotes
3) In single quotes
4) Casting them as nvarchar()
5) Using table.column_name convention
6) Combination of 1 and 5
But still no luck 😞
Solved! Go to Solution.
Hi Nash_s,
Yes, when refer to field, you could use [#"Opportunity Close Date"] to see whether it work or not
In addition, you need to make sure there is no space at the end of column name, you could see my above image, there is a space at the end of [amount], so I need to use [#“amount ”].
By the way, did you refer to last steps's result? If so, you need to use last steps name instead of column name(you could see the #"Added custom" row)
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Nash_s,
Yes, when refer to field, you could use [#"Opportunity Close Date"] to see whether it work or not
In addition, you need to make sure there is no space at the end of column name, you could see my above image, there is a space at the end of [amount], so I need to use [#“amount ”].
By the way, did you refer to last steps's result? If so, you need to use last steps name instead of column name(you could see the #"Added custom" row)
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Could someone help me? I am having the same problem but #"" didn't solve it for me.
I am using ODBC conector to connect to a server where I query the following:
Fonte = Odbc.Query("dsn=default-server", "select "from".taxid from clients")
In this case, using #"from".taxid or [#"from"].taxid keep returning the error "a token was expected ','".
How can I solve it?
I realized that there was space at the end of the field name that made PowerBI to not identify it properly. Thanks for the help. Appreciate it 🙂
Hi @Anonymous ,
Try [#"Opportunity Close Date"]. It should work PQ.
Just had a second thought: you have a problem naming them in PQ, not transferring names to PBI?
Kind regards,
John
Thanks for the response. I realized there was a space after the field name that made PowerBI to not identify the field properly.
@Anonymous
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.