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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Till__
Helper I
Helper I

Renaming multiple Headers

Dear all, 

 

I have multiple Headers which contain an ID before some text occurs. For example like in the table below.

EF-1.1.1) Text1EF-1.1.2) Text 2EF-2.1.1) Text 3  

 

Is there a way to rename all headers by deleting the text? My idea is to work with a list contains EF- code and then to split at the first bracket and deleting the rest of the text so that my end reslut looks like that: 

EF-1.1.1) EF-1.1.2) EF-2.1.1)

 

 

Thank you in advance! 

1 ACCEPTED SOLUTION

 

Okay, try this as a custom step instead:

 

Table.RenameColumns(
    previousStepName,
    List.Transform(
        Table.ColumnNames(previousStepName),
        each {_, if Text.StartsWith(_, "EF") then Text.BeforeDelimiter(_, ")") else _}
    )
)

 

Working example query:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUUoC4mQgTgHiVKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"EF-1.1.1) Some text" = _t, #"EF-1.1.2) Some Words" = _t, #"EF-2.1.1) Some Writing" = _t, #"AB-1.1.1) Some Stuff" = _t, #"TT-1.1.1) Blah Blah" = _t]),
    
    Custom2 =
    Table.RenameColumns(
        Source,
        List.Transform(
            Table.ColumnNames(Source),
            each {_, if Text.StartsWith(_, "EF") then Text.BeforeDelimiter(_, ")") else _}
        )
    )
    
in
    Custom2

 

Example output:BA_Pete_0-1674038407272.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
Till__
Helper I
Helper I

Thank you so much, this works perfectly! 

BA_Pete
Super User
Super User

Hi @Till__ ,

 

You can use the following as a custom step:

= Table.TransformColumnNames(previousStepName, each Text.BeforeDelimiter(_, ")"))

 

Working example query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUUoC4mSl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"EF-1.1.1) Some text" = _t, #"EF-1.1.2) Some Words" = _t, #"EF-2.1.1) Some Writing" = _t]),
    Custom1 = Table.TransformColumnNames(Source, each Text.BeforeDelimiter(_, ")"))
in
    Custom1

 

Example output:

BA_Pete_0-1673876202785.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Dear @BA_Pete, I want to do this only for columns which include the name "EF-"

 

I was trying to do this with the following code but this did not work out... Do you have an idea? 


= Table.TransformColumnNames(#"Erweiterte Tabellenspalte1", each Text.BeforeDelimiter(_, ")",List.Select(Table.ColumnNames(#"Erweiterte Tabellenspalte1"), each Text.Contains(_, "EF-"))))

 

Okay, try this as a custom step instead:

 

Table.RenameColumns(
    previousStepName,
    List.Transform(
        Table.ColumnNames(previousStepName),
        each {_, if Text.StartsWith(_, "EF") then Text.BeforeDelimiter(_, ")") else _}
    )
)

 

Working example query:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlTSUUoC4mQgTgHiVKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"EF-1.1.1) Some text" = _t, #"EF-1.1.2) Some Words" = _t, #"EF-2.1.1) Some Writing" = _t, #"AB-1.1.1) Some Stuff" = _t, #"TT-1.1.1) Blah Blah" = _t]),
    
    Custom2 =
    Table.RenameColumns(
        Source,
        List.Transform(
            Table.ColumnNames(Source),
            each {_, if Text.StartsWith(_, "EF") then Text.BeforeDelimiter(_, ")") else _}
        )
    )
    
in
    Custom2

 

Example output:BA_Pete_0-1674038407272.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.