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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Only get numeric, Decimal numbers or null from the type of any column

Hi All,

 

I have a table in which a column has any type and it has text, numbers, decimals like 0.98 or < 15 days or 15%

I tried to create a custom column using below code but it is not working as I am trying to get.

 

Text.Select(Number.ToText([Monthly Target New]),{"0".."9","."})

 

Here is how the data looks

PowerOn_DP_0-1618592177964.png

In these both cases, I need 2 and 15 

Please help

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi,  @Anonymous 

 

You can modify your code to delete data that is not a number and decimal point, there are many ways.

Like this:

= Table.AddColumn(#"Changed Type", "Custom", each Text.Select([Monthly Target New],{"0".."9","."}))

or 

= Table.AddColumn(#"Changed Type", "Custom", each Text.Remove([Monthly Target New], List.Transform({1..45,47,58..126}, each Character.FromNumber(_))))

 6.png

Reference:Text.Remove - PowerQuery M | Microsoft Docs

 

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

View solution in original post

2 REPLIES 2
v-janeyg-msft
Community Support
Community Support

Hi,  @Anonymous 

 

You can modify your code to delete data that is not a number and decimal point, there are many ways.

Like this:

= Table.AddColumn(#"Changed Type", "Custom", each Text.Select([Monthly Target New],{"0".."9","."}))

or 

= Table.AddColumn(#"Changed Type", "Custom", each Text.Remove([Monthly Target New], List.Transform({1..45,47,58..126}, each Character.FromNumber(_))))

 6.png

Reference:Text.Remove - PowerQuery M | Microsoft Docs

 

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

aj1973
Community Champion
Community Champion

Hi @Anonymous 

You don't need coding to do it. Use replace value to do it in Power Query (Select column then right click). Then change the type of the column.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors