Forum Discussion
Trim data
- 1 year ago
Hi Seth4040 ,
Thank you for reaching out to Microsoft Fabric Community.
In Power BI, open the Power Query Editor, select your table, and add a new custom column using the formula below. Also attached the pbix file for reference.
=Text.Middle(Text.Select(Text.Range([Vendor Invoice], Text.PositionOfAny([Vendor Invoice], {"0".."9"})), {"0".."9", "-"}), 0, 11)
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you!!
Try to add similar m code by creating new column say Clean Account Number,
let
txt = [Vendor Invoice],
pattern = Text.Select(txt, {"0".."9", "-"}),
dashPos = Text.PositionOf(pattern, "-"),
account =
if dashPos = 8 and Text.Length(pattern) >= 10
then Text.Middle(pattern, 0, 10)
else null
in
account
- Seth40401 year agoRegular Visitor
Sorry I am trying to see where to get this and start within Power Query.