Forum Discussion
teylyn
5 years agoAdvocate III
M Code to replace underscores in column names
Hi all, my SQL Server DBA tells me that SQL doesn't like spaces in column names, and all tables and views in that project have unsightly underscores. In Power BI, I want to replace them with blan...
- 5 years ago
Table.RenameColumns(Navigation,List.Transform(Table.ColumnNames(Navigation),each {_,Text.Replace(_,"_"," ")}))
- 5 years ago
Hi teylyn and wdx223_Daniel ,
I've been there as well before I've discovered that the M-language has some nice functions that are not exposed through the UI. Transforming column names with a custom function is one of them:Table.TransformColumnNames(Source, each Text.Replace(_, "_", " ") )
DAXTERONPOWERBI
4 years agoNew Member
Hi, this solution does not work instead it gives follwing error
Expression.SyntaxError: Token Eof expected.
Rustickoff
3 years agoNew Member
Please kindly change Navigation with the name of previous step/table name and replace with Text.Replace(_," ","_") if you want to replace space with _