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
jshwong
New Member

Replacing column name text in each column

Hi,

I would like to remove the column name text if it is found in each column as follows.

Replace Text.png

Any idea how this can be achieved in Power Query?

Many thanks.

1 ACCEPTED SOLUTION
Jakinta
Solution Sage
Solution Sage

You can try this in new blank query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQquLDaMj0wthjCNEExjMDNWJ1rJiDhlxkABiDCCBImbQNjxICMQTCME0xiszJQIW2IB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Sys1 = _t, Sys2 = _t, Sys3 = _t]),
    Custom1 = let l=Table.ToColumns(Source), cols=Table.ColumnNames(Source), i= List.Positions(cols), new= List.Transform (i, each List.ReplaceValue( l{_}, cols{_}&"_","", Replacer.ReplaceText) ) in Table.FromColumns(new, cols)

in
    Custom1

 

Start:

Jakinta_0-1633254972772.png

End:

Jakinta_1-1633254990912.png

 

 

 

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

@jshwong 

You can either right-click on the column, select Replace Value and Enter "Sys1_" with blank

Fowmy_0-1633254549844.png


Or, Under Transform Tab, Click Extract and select Text After Delimiter 

Fowmy_1-1633254631042.png

 

 

 

Fowmy
Super User
Super User

@jshwong 

You can either right-click on the column, select Replace Value and Enter "Sys1_" with blank

Fowmy_0-1633254549844.png


Or, Under Transform Tab, Click Extract and select Text After Delimiter 

Fowmy_1-1633254631042.png

 

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Jakinta
Solution Sage
Solution Sage

You can try this in new blank query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQquLDaMj0wthjCNEExjMDNWJ1rJiDhlxkABiDCCBImbQNjxICMQTCME0xiszJQIW2IB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Sys1 = _t, Sys2 = _t, Sys3 = _t]),
    Custom1 = let l=Table.ToColumns(Source), cols=Table.ColumnNames(Source), i= List.Positions(cols), new= List.Transform (i, each List.ReplaceValue( l{_}, cols{_}&"_","", Replacer.ReplaceText) ) in Table.FromColumns(new, cols)

in
    Custom1

 

Start:

Jakinta_0-1633254972772.png

End:

Jakinta_1-1633254990912.png

 

 

 

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors