Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

How to replace a delimiter with an increase number ?

I have a column like  as below with a delimiter ";"

 

41.0223979,29.019951;41.0029523,29.0507535;41.0542336,28.9300755;40.999712,28.9225336

 

which i would like to convert like as below

 

41.0223979,29.019951wp0141.0029523,29.0507535wp0241.0542336,28.9300755wp0340.999712,28.9225336

 

Simply replacing each ";" into "wp??

?? means increasing number for each value

 

Can you please support how to do that?

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HcnBDcAgDAPAXXijKHFwqdVREPuvQcr3bq02whxITXXIPCTG96NDRF6kTyavciDz6XhN6cWlbpJm4CLA+rb3AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Orig = _t]),
    #"Repl Delim" = Table.AddColumn(Source, "Repl Delim", each List.Accumulate({1..List.Count(Text.PositionOf([Orig], ";", 2))}, [Orig], (s,c) => Text.ReplaceRange(s, Text.PositionOf(s, ";"), 1, "pw" & Text.PadStart(Text.From(c), 2, "0"))))
in
    #"Repl Delim"

Screenshot 2021-10-15 011010.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Here is another way to do it, but the one by @CNENFRNL is more elegant.  Add a custom column and put this formula in the pop-up box, replacing [StringColumn] with the name of your actual column.

 

let thislist = Text.Split([StringColumn], ";"),
wplist = List.Transform({1..List.Count(thislist)-1}, each "wp"& Text.PadStart(Number.ToText(_), 2, "0"))&{""},
zipped = List.Zip({thislist, wplist}),
concatenated = List.Transform(zipped, each Text.Combine(_, ""))
in
Text.Combine(concatenated, "")

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HcnBDcAgDAPAXXijKHFwqdVREPuvQcr3bq02whxITXXIPCTG96NDRF6kTyavciDz6XhN6cWlbpJm4CLA+rb3AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Orig = _t]),
    #"Repl Delim" = Table.AddColumn(Source, "Repl Delim", each List.Accumulate({1..List.Count(Text.PositionOf([Orig], ";", 2))}, [Orig], (s,c) => Text.ReplaceRange(s, Text.PositionOf(s, ";"), 1, "pw" & Text.PadStart(Text.From(c), 2, "0"))))
in
    #"Repl Delim"

Screenshot 2021-10-15 011010.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.