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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ArulselvanD07
Helper I
Helper I

How to capitalize the each word in column names pulled from the Oracle source

I have Oracle DB as the source and I have imported close to 10 tables and the total number of columns imported are around 100. Oracle uses the format "COLUMN_NAME" for it's columns, I want to change it to something more meaningful, say "Column Name". I searched for options to do it in Power BI, but couldn't find that option.

 

Is there a way we can change the Column names to replace the underscore with space and then Capitalize each word instead of manually renaming all the columns one by one? Please note that I have used the import mode with query override. Thanks in advance for your suggestions.

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

Hi @ArulselvanD07,

this query contains the necessary steps:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [COLumn_FJKD1 = _t, Column_ASDLFKJA = _t]),
    OldColNames = Table.ColumnNames(Source),
    ReplaceUnderscore = List.Transform(OldColNames, each Text.Replace(_, "_", " ")),
    NewColNames = List.Transform(ReplaceUnderscore, each Text.Proper(_)),
    Rename = Table.RenameColumns(Source,List.Zip({Table.ColumnNames(Source), NewColNames}))
in
    Rename

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Super User
Super User

Hi @ArulselvanD07,

this query contains the necessary steps:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJSio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [COLumn_FJKD1 = _t, Column_ASDLFKJA = _t]),
    OldColNames = Table.ColumnNames(Source),
    ReplaceUnderscore = List.Transform(OldColNames, each Text.Replace(_, "_", " ")),
    NewColNames = List.Transform(ReplaceUnderscore, each Text.Proper(_)),
    Rename = Table.RenameColumns(Source,List.Zip({Table.ColumnNames(Source), NewColNames}))
in
    Rename

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi ImkeF - how can you pull from multiple source points?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Carousel June 2024

Check out the June 2024 Power BI update to learn about new features.

2
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.