cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gdibbs
Frequent Visitor

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
Gdibbs
Frequent Visitor

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

Gdibbs
Frequent Visitor

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.

Gdibbs
Frequent Visitor

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!