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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
sdhn
Responsive Resident
Responsive Resident

TRIM text and _

Hi All,

 

I have list of items in  a table as below:

 

LON_HOME

LON_ADDRESS
LON_PERSON
LON_OWNER  etc

 

I want data appears in the report as:  

 

 

HOME
ADDRESS
PERSON
OWNER

 

I am using Power Bi desktop version.

 

Thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

There can be many ways to do it.

1. In power query replace LON_ to blank.

2. You can split the column in Power query by number of delimiters as 4 as far left as possible.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @sdhn ,

You can copy and paste the following codes in your Advanced Editor:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8vH3i/fw93VVitWBcBxdXIJcg4Ph/ADXoGB/PzjXP9zPNUgpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Text = _t]),
    #"Trimmed Text" = Table.TransformColumns(Source,{{"Text", Text.Trim, type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Trimmed Text","LON_","",Replacer.ReplaceText,{"Text"})
in
    #"Replaced Value"

 

replace value.JPG

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

There can be many ways to do it.

1. In power query replace LON_ to blank.

2. You can split the column in Power query by number of delimiters as 4 as far left as possible.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.