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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
heiligbd
Helper I
Helper I

Search column for anything other than numbers

I need to search and replace any letters in a column (could be aA-zZ) with a number or if the row contains only a number to leave the number.  How can I use a wildcard or something else to convert any field with any letter character and replace with zero? These are calculated columns so I can't make this change in power query.

Example rows

Column ANew Column
15001500
mno0
20002000
abc0
dfg0
350350
qrs0
900900

 

2 ACCEPTED SOLUTIONS
HotChilli
Super User
Super User

Was that stated in the original post or have you edited it? If so, I apologise.

In DAX, you can use an IFERROR to assign a different value,

so can you add a new column, CONVERT to integer and assign 0 if it throws an error.

I'll let you get on with that.

View solution in original post

Padycosmos
Solution Sage
Solution Sage

Hope this helps:

Padycosmos_0-1677604133381.png

 

View solution in original post

4 REPLIES 4
Padycosmos
Solution Sage
Solution Sage

Hope this helps:

Padycosmos_0-1677604133381.png

 

HotChilli
Super User
Super User

Was that stated in the original post or have you edited it? If so, I apologise.

In DAX, you can use an IFERROR to assign a different value,

so can you add a new column, CONVERT to integer and assign 0 if it throws an error.

I'll let you get on with that.

HotChilli
Super User
Super User

In Power Query, change the datatype to number.

Then replace Errors with 0.

You can do this from the interface.

I can't do it in power query. Its a calculated column outside of power query.

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.