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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
matratus28
Resolver I
Resolver I

Avoid Error when removing Text

Hi,

Hopefully a nice easy one! (but not for me obviously!)

 

I've got a column called [UOP] with units of purchase in it.

e.g:

 

Box of 25

Case of 10

Box 100

1

25

2 Bottles

 

I want to strip of the text and leave only numerical values so I can do some calculations.

 

I'm using the code below, to add a custom column to remove the text from the string, but if there is no text and only a number to start with already then I get an error.

Any help to return the exsiting numerical value rather than the error would be appreciated.

 

Text.Remove(
      [UOP],
      {
        Character.FromNumber(32) .. Character.FromNumber(47),
        Character.FromNumber(58) .. Character.FromNumber(255)
      }
    )

 

 

1 ACCEPTED SOLUTION

@AlienSx thanks for the reply. Sorry but I didn't quite understand what you meant.

 

I have got a solution though - my UOP column was stored as a combination of Text and numbers ABC/123.

 

I changed the data type to Text on my original column, and it removes the error.

View solution in original post

3 REPLIES 3
AlienSx
Super User
Super User

Hello, @matratus28 try to replace [UOP] in your formula with Text.From([UOP])

@AlienSx thanks for the reply. Sorry but I didn't quite understand what you meant.

 

I have got a solution though - my UOP column was stored as a combination of Text and numbers ABC/123.

 

I changed the data type to Text on my original column, and it removes the error.

matratus28
Resolver I
Resolver I

This is an example of my current output

matratus28_0-1694615960885.png

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.