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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to remove last character on a string before delimiter ( - )

Hi  community,

I have the following challenge, my Path_no_cycle column looks like this:

JoseBernardo_0-1669365000002.png

I need to keep only the first 3 digit before every ( - )

If we take one as example :


ORIGINAL data VALUE:

CGNA-CGNH-CDGH-MRSA-MLAT7-MLAT8


DESIRE DATA VALUE data VALUE:

CGN-CGN-CDG-MRS-MLA-MLA

 

Thanks!

1 ACCEPTED SOLUTION

@Anonymous 

In Power Query...

 

1st... Split Column by Delimiter ("-")

 

2nd... Select All Column and then Replace null => "del" value

 

3rd... Select All Column then in Transform => Extract => First Characters (3)

 

4th... Select All Coumn and then in Tranform => Merge Columns ("-")

 

5th... Replace "-del" => blank

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Nofil098_0-1669371753437.png

Here you go. 

ddpl
Solution Sage
Solution Sage

@Anonymous 

 

In Power Query...

 

1st... Split Column by Delimiter ("-")

 

2nd... Select All Column then in Transform => Extract => First Characters (3)

 

3rd... Select All Coumn and then in Tranform => Merge Columns ("-")

Anonymous
Not applicable

Thanks i think we are close!

 

Since not all the strings have the same leng i have some null and the result is: ( i see -----after the laste one)

JoseBernardo_0-1669368725340.png

 

@Anonymous 

In Power Query...

 

1st... Split Column by Delimiter ("-")

 

2nd... Select All Column and then Replace null => "del" value

 

3rd... Select All Column then in Transform => Extract => First Characters (3)

 

4th... Select All Coumn and then in Tranform => Merge Columns ("-")

 

5th... Replace "-del" => blank

Anonymous
Not applicable

Great!!! thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.