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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Replace numbers with blank in a column containing text and numbers.

I have a column containing text and numbers. I want to replace the numbers with blank. Any idea how to do that.

 

1
2
3
a
b
c
d
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

You can add a custom column in query editor with the following formula to achieve your requirement:

#"Added Custom" = Table.AddColumn(Source, "Custom", each if Value.Is(Value.FromText([Desc]),type number) then null else [Desc])

Full query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY9RC4IwEMe/ivgcoUbQq2WKkSjNN5FjusMGuoWbhd8+GSWB9vKD3e/udv+isEMCV/nCHlk0cEZFjdBjjaIeLbvcGH+jXP3TOYGnbMH1nG93Rkc56BvVXM4bzsc4D3xIaN9wAVpChtgra2VkKYOMwEkKlSBbShL92eps3cPvgd5+PjCXmra+UqjVp2RdsnT6o3u0qJfx40mGvF0Gryq4V1Sw9Zhzm8BmSvZEgkLzbsJszokPJDUv19Az3BlSw8qwNmR2Wb4B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Desc = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each if Value.Is(Value.FromText([Desc]),type number) then null else [Desc])
in
    #"Added Custom"

1.png

Regards,

Xiaoxin Sheng

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

HI @Anonymous,

You can add a custom column in query editor with the following formula to achieve your requirement:

#"Added Custom" = Table.AddColumn(Source, "Custom", each if Value.Is(Value.FromText([Desc]),type number) then null else [Desc])

Full query:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dY9RC4IwEMe/ivgcoUbQq2WKkSjNN5FjusMGuoWbhd8+GSWB9vKD3e/udv+isEMCV/nCHlk0cEZFjdBjjaIeLbvcGH+jXP3TOYGnbMH1nG93Rkc56BvVXM4bzsc4D3xIaN9wAVpChtgra2VkKYOMwEkKlSBbShL92eps3cPvgd5+PjCXmra+UqjVp2RdsnT6o3u0qJfx40mGvF0Gryq4V1Sw9Zhzm8BmSvZEgkLzbsJszokPJDUv19Az3BlSw8qwNmR2Wb4B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Desc = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each if Value.Is(Value.FromText([Desc]),type number) then null else [Desc])
in
    #"Added Custom"

1.png

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

Dax

=IF(ISNUMBER([fiedl]), blank(), [field])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

A very straight forward solution is to add a new column during import and use code like:

 

if Value.Is([OldColumn], type text) then [OldColumn] else null

 

 

You could remove or keep the old column as needed.  You can also rename the new column if you want to keep your model happy.

Anonymous
Not applicable

sample.PNG

 

I have alphanumeric characters in some of the rows . Your suggested code is not working. I changed the data type to any but doesn't remove the numeric row. 

Anonymous
Not applicable

@Anonymousyou are right, this isn't converting correctly.  Please see this previous solution

 

https://stackoverflow.com/questions/36768353/power-query-replace-all-numbers-with-null

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors