Forum Discussion
Remove text after any number
- Anonymous1 year ago
Hi non23 ,
Thank you for reaching out to the Microsoft Fabric Community.
I tried the following M Query on my end, and it worked successfully:
let
textValue = [Data],
zPos = Text.PositionOf(textValue, "Z", Occurrence.First),
numbers = {"0".."9"},
lastNumPos = List.Max(List.Transform(numbers, each Text.PositionOf(textValue, _, Occurrence.Last))),
start = if zPos = -1 then 0 else zPos + 1,
end = if lastNumPos = -1 then Text.Length(textValue) else lastNumPos + 1,
extractedText = Text.Middle(textValue, start, end - start)
in
extractedText
Since it worked for me, I am attaching a PBIX file to help you understand the setup better. If you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Hi non23 ,
Thank you for reaching out to the Microsoft Fabric Community.
I tried the following M Query on my end, and it worked successfully:
let
textValue = [Data],
zPos = Text.PositionOf(textValue, "Z", Occurrence.First),
numbers = {"0".."9"},
lastNumPos = List.Max(List.Transform(numbers, each Text.PositionOf(textValue, _, Occurrence.Last))),
start = if zPos = -1 then 0 else zPos + 1,
end = if lastNumPos = -1 then Text.Length(textValue) else lastNumPos + 1,
extractedText = Text.Middle(textValue, start, end - start)
in
extractedText
Since it worked for me, I am attaching a PBIX file to help you understand the setup better. If you need any further assistance, feel free to reach out.
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Thank you.
Hi non23 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- Anonymous1 year agoNot applicable
Hi non23 ,
I wanted to follow up on our previous suggestions regarding the issue. We would love to hear back from you to ensure we can assist you further.
If my response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there’s anything else we can do to help.
Thank you.
- Anonymous1 year agoNot applicable
Hi non23 ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.