Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I am using this to Find/Replace a table
let
Repl = Table.Buffer(ReplacementsTable),
Text = Text,
Result = Table.AddColumn(Text, "Changed Text Expected",
each Text.Combine(
List.Transform(
Text.Split([Text], "|"),
each
try Repl[Replace With]{List.PositionOf(Repl[Word To Replace], _)}
otherwise _
),
"|" )
)
[[Changed Text Expected]]
in
Result
I am splitting a column on a pipe delimiter
Is it possible to add trim at this point?
Text.Split([Text], “|”),
I have strings that look like
the|cat sat |on the mat
find replace
cat sat >> bear
does not get replaced because of the space after the "sat" in “the|cat sat |on the mat”
Thanks
Solved! Go to Solution.
Use below in place of Text.Split([Text], "|")
Text.Split(Text.Replace(Text.Replace([Text]," |","|"),"| ","|") "|")
You can replace
Text.Split([Text], "|")
with
List.Transform(Text.Split([Text], "|"), Text.Trim)
to trim each string after separating by "|".
Here's another implementation that uses List.ReplaceMatchingItems:
let
Repl = Table.Buffer(ReplacementsTable),
Text = Text,
Result = Table.AddColumn(
Text,
"Changed Text Expected",
each Text.Combine(
List.ReplaceMatchingItems(
List.Transform(Text.Split([Text], "|"), Text.Trim),
List.Zip({Repl[Word To Replace], Repl[Replace With]})
),
"|"
)
)
in
Result
Use below in place of Text.Split([Text], "|")
Text.Split(Text.Replace(Text.Replace([Text]," |","|"),"| ","|") "|")
Thank you. This worked great!
@Anonymous
Do you have limited scenarios then maybe try replacing value, else could you please share some sample data (5-10) rows and the expected output.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |