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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Remove trailing Semicolons - Varied Amount

How can I remove the trailing;;;; of the names in a column. As the below example of 2 cells, there could be any number of Semicolons.

Anywhere from 1 to 36. How can I remove them?

 

SEMIGIS, Satina; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 
KIEGELWYN, Bigny; NIBBS, Lem; MAUR, Kani; KRAGAN, Len; BINGH, Bendy; CRYERS, Lilly; MERMANER, Fruti; ORCHARD, Apple; SERAH, Vee; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; 

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Use Text.Remove

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Data", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Remove([Data], {";"})),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"})
in
    #"Removed Columns"

 

This query loads data from a table named Table1 with your text in a column called Data - see file below.

Then adds a custom column which calls Text.Remove.

cust.png

Finally, delete the original column to leave you with your cleaned text.

Please see file linked to below.  This is an Excel workbook but you can copy/paste the query into the PBI advanced query editor.  Or just copy/paste the query above and modify to suit your data source location.

Phil

Text.Remove.xlsx 


If I answered your question please mark my post as the solution.

If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Use Text.Remove

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Data", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Remove([Data], {";"})),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"})
in
    #"Removed Columns"

 

This query loads data from a table named Table1 with your text in a column called Data - see file below.

Then adds a custom column which calls Text.Remove.

cust.png

Finally, delete the original column to leave you with your cleaned text.

Please see file linked to below.  This is an Excel workbook but you can copy/paste the query into the PBI advanced query editor.  Or just copy/paste the query above and modify to suit your data source location.

Phil

Text.Remove.xlsx 


If I answered your question please mark my post as the solution.

If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors