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

Pull substring of text that is on the left side of a symbol - Calculated Column

This is what a string looks like in my Billing Code column:
A123-Z5
 
My desired result is:
A123
 
I am simply wanting to pull text that is to the left of the "-" symbol. I was able to find a somewhat complex formula that can pull the Z5 from the right side of the "-" but for some reason it is really difficult creating or even finding a formula that can simply pull text from the left side of a symbol. Please assist 🙂
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Anonymous,

 

you can achieve what you want by marking the column inside Power Query, please be aware that the steps are "destructive", this means the original column will be "destroyed" by the following operations. If you want to keep the original column make sure you duplicate the column before you apply the following steps.

TomMartens_0-1607375832590.png

From the context menu choose "Split column" --> "By delimiter"

Choose the settings as below, just use the - instead of the h:

TomMartens_1-1607375906864.png

Hopefully, this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Anonymous 

You can just add a Custom Column with this 1 line (where Billing Code is the column name)

 

= Text.Start([Billing Code], Text.PositionOf([Billing Code], "-"))

 

regards

Phil


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!


TomMartens
Super User
Super User

Hey @Anonymous,

 

you can achieve what you want by marking the column inside Power Query, please be aware that the steps are "destructive", this means the original column will be "destroyed" by the following operations. If you want to keep the original column make sure you duplicate the column before you apply the following steps.

TomMartens_0-1607375832590.png

From the context menu choose "Split column" --> "By delimiter"

Choose the settings as below, just use the - instead of the h:

TomMartens_1-1607375906864.png

Hopefully, this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.