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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
NehaliSurve
Regular Visitor

How to Rename all column names through Direct query in Power BI

Hello,

 

I have 15 tables in my datamodel which are connected through direct query to postgres database in Power BI. I want to rename all columns in those 15 tables in bulk not through manually one by one. I want to replace '_' underscore with space. For example,

Old Column Name: customer_account_name  , New Column Name: Customer Account Name

Is there any solution then please help.

Below m-query i am using:

NamesBuffered = List.Buffer( Table.ColumnNames( Source ) ),
NewNames = List.ReplaceValue( NamesBuffered, " ", "_", Replacer.ReplaceText ),
Result = Table.RenameColumns( Source,
List.Zip( { NamesBuffered, NewNames } ) )

 

NehaliSurve_0-1681226811509.png

 

 

 

Thanks in Advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @NehaliSurve ,

 

When the connection mode is DirectQuery mode, you can't rename the column headers in Power Query.

This is because DirectQuery mode does not import data into Power BI, so the column headers are defined by the data source. Therefore, you can't rename the column headers in Power Query.

This is also indicated in the screenshot you provided.

vstephenmsft_0-1681798837975.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @NehaliSurve ,

 

When the connection mode is DirectQuery mode, you can't rename the column headers in Power Query.

This is because DirectQuery mode does not import data into Power BI, so the column headers are defined by the data source. Therefore, you can't rename the column headers in Power Query.

This is also indicated in the screenshot you provided.

vstephenmsft_0-1681798837975.png

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors