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
Gdibbs
Helper I
Helper I

How do I cut characters in a column and return what's left into a new column?

Hello,

 

New Power BI User ... after a lot of research and attempts I am going to ask here.  I suspect this is easy, but I am not figuring it out.

 

I want to take the data in a column (below) and put it in a new column, but where the "APA/" is dropped.  Hence, I want only the numerical values which would be left after removing the first 4 characters.   "end" function does not work because the numerical values I want vary in length.

 

This is my code, but it does not work.   #"Added Custom7" = Table.AddColumn(#"Added Custom6", "Sold-To#", each List.RemoveFirstN([#"Sold-To Party#"],"4"))

 

Any feedback would be great.  I want it to work, of course, but also want to learn why what I am doing is not working. 

 

Cheers,

 

Gdibbs_0-1625761253752.png

 

Result:

 

Gdibbs_1-1625761968912.png

 

 

1 ACCEPTED SOLUTION

Thanks.  I think I got it to work.  And thank you for the hint with the delimiter.  I deleted the line and added a new one where I used text.afterdelimiter.  

 

#"Added Custom8" = Table.AddColumn(#"Removed Columns", "Sold-To #", each Text.AfterDelimiter([#"Sold-To Party#"],"/"))

 

I am not a programmer, but one in training.  Love the forum, collaboration and support. Felt great to get the result I was looking for.  Next step is a more complex one... can't wait to work on solving it.

View solution in original post

5 REPLIES 5
HotChilli
Super User
Super User

right-click the column and Split by delimiter.  You'll work it out

Thank you for the quick response.  However, I have no idea what you mean.  I am very early on in this journey.

 

I guess my first question would be... is the code correct?

No. Throw it away (by which I mean delete the step)

 

My advice for a beginner is to use the interface as much as possible.  So after deleting the query step, apply my previous answer and get back to me.  I'll help if you need it.

Thanks.  I think I got it to work.  And thank you for the hint with the delimiter.  I deleted the line and added a new one where I used text.afterdelimiter.  

 

#"Added Custom8" = Table.AddColumn(#"Removed Columns", "Sold-To #", each Text.AfterDelimiter([#"Sold-To Party#"],"/"))

 

I am not a programmer, but one in training.  Love the forum, collaboration and support. Felt great to get the result I was looking for.  Next step is a more complex one... can't wait to work on solving it.

Hi, @Gdibbs 

Great to hear the problem got resolved!

Please accept the useful reply as solution to close this thread, so that other community members will easily find the solution when they get the same issue.

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.