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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
KasiaB
Frequent Visitor

how to get rod od number

Hi There, I have a colum with text with numbers and numbers divided by "/" and "-". I just need text with numbers. What is the quickes way to get rid of numbers and special characters. Please advice. Thanks, Kasia 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @KasiaB ,

 

Have you tried @AlexisOlson ‘s solution?

I tried his code and got the results.

 

Sample data.

vstephenmsft_0-1640848597023.png

 

1.Add a custom column.

Table.SelectRows(#"Added Index",
    each [#"P/Date Shft"]<> null and
    not List.ContainsAll(Text.ToList([#"P/Date Shft"]), {"/", "-"})
)

vstephenmsft_2-1640848869445.png

 

 

2.Add as New Query.

vstephenmsft_3-1640848958084.png

 

3.Turn to table, expand the needed column and remove duplicates.

vstephenmsft_4-1640849072130.png

vstephenmsft_6-1640850255803.pngvstephenmsft_7-1640850266603.png

vstephenmsft_8-1640850274735.png

 

4.Merge as follows and then expand the column.

vstephenmsft_9-1640850485340.png

vstephenmsft_10-1640850513535.png

 

5.Fill down.

vstephenmsft_11-1640850561858.png

vstephenmsft_12-1640850572059.png

 

 

 

Best Regards,

Stephen Tao

 

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

9 REPLIES 9
Anonymous
Not applicable

Hi @KasiaB ,

 

Have you tried @AlexisOlson ‘s solution?

I tried his code and got the results.

 

Sample data.

vstephenmsft_0-1640848597023.png

 

1.Add a custom column.

Table.SelectRows(#"Added Index",
    each [#"P/Date Shft"]<> null and
    not List.ContainsAll(Text.ToList([#"P/Date Shft"]), {"/", "-"})
)

vstephenmsft_2-1640848869445.png

 

 

2.Add as New Query.

vstephenmsft_3-1640848958084.png

 

3.Turn to table, expand the needed column and remove duplicates.

vstephenmsft_4-1640849072130.png

vstephenmsft_6-1640850255803.pngvstephenmsft_7-1640850266603.png

vstephenmsft_8-1640850274735.png

 

4.Merge as follows and then expand the column.

vstephenmsft_9-1640850485340.png

vstephenmsft_10-1640850513535.png

 

5.Fill down.

vstephenmsft_11-1640850561858.png

vstephenmsft_12-1640850572059.png

 

 

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

In that case, just split the column with the delimiter as "-/". Even better is to use Text.BeforeDelimiter, with "/-" as the delimiter.

 

--Nate

KasiaB
Frequent Visitor

Let me rephrase. I have an file with different production data that I need to transform. In one colum there are two types of data: machine name (text and number) and date (numbers that are separated by "/" and "-"). For all lines in this file I just need the machine name, so I would like to get rid of numbers separated by "/" and "-" and then I could fill down all line with machine name. So I don't want to get rid of only "/" and "-". 

 

Here is the screenshot from the file. Cell 1 is the name of machine that I need and line 2, 4, 6 is what I'm training to get rid of. Further down there are other names of machines. 

 

KasiaB_1-1639764271286.png

Hope that this time I made it more clear.

 

Thank!

Add a step to filter out the nulls. It will generate some code like this.

= Table.SelectRows(#"Changed Type", each ([#"P/Date Shift"] <> null))

Modify this code to also remove rows that contain both "/" and "-".

= Table.SelectRows(#"Changed Type",
    each [#"P/Date Shift"] <> null and
    not List.ContainsAll(Text.ToList([#"P/Date Shift"]), {"/", "-"})
)

@KasiaB what is the desired output for the screenshot you gave ?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
KasiaB
Frequent Visitor

Machine names in all Cells down, so for this example would be "D Flexo10"

Anonymous
Not applicable

= Table.TransformColumns(TableOrPreviousStepName, {"Column Name", each Text.Remove(_,  {"/","-"}))

 

--Nate

Or you can specify what you want to keep instead of what to remove.

Table.TransformColumns(#"Prev Step", {"ColName", each Text.Select(_,  {"0".."9"}))

The above assumes you only want digits 0-9.

smpa01
Super User
Super User

@KasiaB  provide some sample string and desired output

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.