Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello, I'm new to using PowerQuery and I'm trying to clean up a column on one table to create a relationship with another table.
The column I'm attempting to clean up is a free text field from a maintenance system, and the goal is to remove all unrequired text and leave only what we want EX: MA-1405.
I've played around with the Replace Values tool, trying to remove and change as much as I can to then extract text before delimiter, however with it being a free text field there are plenty of delimiters and occassionally there is text before the MA#
I know that in Excel you can use ** to represent a string of characters and was wondering if a similar feature existed here as well?
Ideally I'd like to put in one formula to replace all values except "MA-***"
You can add a column with this formula, then remove the original column, and presumably filter out the rows that return null.
if Text.Contains([Column1],"MA-") = true
then Text.Middle([Column1],Text.PositionOf([Column1],"MA-"),7)
else null
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHello @Anonymous
have you been able to solve the problem with the replies given?
If so, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
All the best
Jimmy
Hello @Anonymous
you can use a combination of Text.PositionOf and Text.Middle. Adding a try otherwise enablse to identifying those rows that don't contain any MA-****
let
Source = #table
(
{"FreeTextColumn"},
{
{"xxasdfMA-1450…sdf"}, {"sssktest MA-1111"}, {"kkMA-11558888884"}, {"88oeoeMA-15444"}
}
),
AddColumn = Table.AddColumn
(
Source,
"extract MA",
(add)=> try
Text.Middle
(
add[FreeTextColumn],
Text.PositionOf(add[FreeTextColumn], "MA-"),
7
)
otherwise
"contains NO MA-"
)
in
AddColumn
Copy paste this code to the advanced editor to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.