The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
How can I delete a group of numbers. For example, the red ones (they are always like that 7 numbers - 1 number)
should be like this:
Solved! Go to Solution.
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:
Pete
Proud to be a Datanaut!
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)="-")," "))
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:
Pete
Proud to be a Datanaut!
Hi, thanks, this was the perfect solution to my problem. Many thanks to you!!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
37 | |
23 | |
23 | |
18 | |
16 |