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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
I_ia
Frequent Visitor

Delete a group of numbers

Hi,

 

How can I delete a group of numbers. For example, the red ones (they are always like that 7 numbers - 1 number)

I_ia_3-1661344255872.png

 

should be like this:

I_ia_1-1661344141277.png

 

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @I_ia ,

 

Create a new blank query and paste the following code over the default code in Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Hcs7DgMhDEXRrTxRB2mwgZl1pEqEKCgoLBSQYk8xu8+nvTq3FBdxvcUuBcUtBiLPrt6Ke/7i0G7gcBw7s8/wuHc1PP4gY4hM66K2YNLn67TRwHFDSJQpJb9/DzuXtTmXanO1fgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [textColumn = _t]),
    addSplitList = Table.AddColumn(Source, "splitList", each Text.Split([textColumn], " ")),
    addReplaceList = Table.AddColumn(addSplitList, "replaceList", each List.Transform([splitList], each if Text.Contains(_, "-") and Text.Length(_) = 9 then null else _)),
    addCombineList = Table.AddColumn(addReplaceList, "combineList", each Text.Combine([replaceList], " ")),
    remOthCols = Table.SelectColumns(addCombineList,{"textColumn", "combineList"})
in
    remOthCols

 

I've left the steps separate so it'd easier to follow what's going on, but this could easily be written into a single step.

This gives me the following ouput:

BA_Pete_0-1661424356501.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
wdx223_Daniel
Super User
Super User

just for the sample data

= Table.AddColumn(PreviousStepName,"Custom",each Text.Combine(List.RemoveMatchingItems(Text.Split([textColumn]," "),{true},each if _ is logical then _ else Text.Length(_)=9 and Text.Remove(_,{"0".."9"})="-" and Text.At(_,7)="-")," "))

BA_Pete
Super User
Super User

Hi @I_ia ,

 

Create a new blank query and paste the following code over the default code in Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Hcs7DgMhDEXRrTxRB2mwgZl1pEqEKCgoLBSQYk8xu8+nvTq3FBdxvcUuBcUtBiLPrt6Ke/7i0G7gcBw7s8/wuHc1PP4gY4hM66K2YNLn67TRwHFDSJQpJb9/DzuXtTmXanO1fgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [textColumn = _t]),
    addSplitList = Table.AddColumn(Source, "splitList", each Text.Split([textColumn], " ")),
    addReplaceList = Table.AddColumn(addSplitList, "replaceList", each List.Transform([splitList], each if Text.Contains(_, "-") and Text.Length(_) = 9 then null else _)),
    addCombineList = Table.AddColumn(addReplaceList, "combineList", each Text.Combine([replaceList], " ")),
    remOthCols = Table.SelectColumns(addCombineList,{"textColumn", "combineList"})
in
    remOthCols

 

I've left the steps separate so it'd easier to follow what's going on, but this could easily be written into a single step.

This gives me the following ouput:

BA_Pete_0-1661424356501.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




I_ia
Frequent Visitor

 

Hi, thanks, this was the perfect solution to my problem. Many thanks to you!!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors