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

Substring from an exited column

I hav a colum productName, how can I add new column Prodcutnew wich I do a substring from position4?

 

For example

PoductName: 01-Auto I need to dispaly Auto

4 REPLIES 4
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use two ways to meet your requirement.

 

1. In Power Query, we can use the split column function.

 

substring 1.jpg

 

2. Or we can create a calculate column to split it.

 

Prodcutnew = 
var len__ = LEN('Table'[Product])
var location__ = FIND("-",'Table'[Product],1,0)
return
RIGHT('Table'[Product],len__ - location__)

 

substring 2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that we have shared?

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ibarrau
Super User
Super User

Hi, there is an "Extract" option on the menu in query editor to extract with ranges. You can use that to get a formula like this:

= Table.AddColumn(#"Last Step", "Text Range Column", each Text.Middle([ColumnName], 3, 10), type text)

The 3 is the characters to avoid from the beginning and the 10 is the number of chars to consider on the rest of the string.

You can add that step in a blank one or search for "Extract" option under "Add Column" tab in query editor.

 

Regards, 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

@ibarrau 

How can I put "10" total number of caracter? because I don't have the same total number of caracter for each product.

Consider adding the max number of chars that can be found on the column. If the column has less it won't matter because it will find the first, let's say 2, and extract the value. The 10 was an example.

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

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.