- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Replacing comma separated values to texts with creating a New column
Trying to create a Column with below Logic
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Combine( List.ReplaceMatchingItems(Text.ToList ([CommaSeparatedNumbersColumnName]), { {100,"A" },{"200","B" },{"300","C" },{",","." } })),type text)
expected result
100,200,300 ---> A.B.C
100------------->A
100,200 --------->A,B
Note : only {",","." } this part replaced
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@PowerBITesting - You can use SUBSTITUTE in DAX:
New Column =
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE([Column],"100","A"),
"200","B"
),
"300","C"
)
Should be able to do the same thing in Power Query essentially nesting your replacer functions. @ImkeF @edhans
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Try this @PowerBITesting
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQw0DECYmMDA6VYHTAfRkPEYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" =
Table.AddColumn(
Source,
"Custom",
each
Text.Combine(
List.ReplaceMatchingItems(
{Text.Split([Column1], ",")}{0},
{{"100","A"},{"200","B"},{"300","C"}}
),"."
)
)
in
#"Added Custom"
It generates this (NOTE: Above code properly replaces the comma with period. My screenshot below doesn't reflect that)
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@PowerBITesting - You can use SUBSTITUTE in DAX:
New Column =
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE([Column],"100","A"),
"200","B"
),
"300","C"
)
Should be able to do the same thing in Power Query essentially nesting your replacer functions. @ImkeF @edhans
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@PowerBITesting , if they are comma-separated number then use Text.Split in place of Text.ToList and try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@amitchandak - did you try your suggestion? It just returns an error when I try that simple replacement.
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@edhans , There was a formula give with the result and I assumed it working and text.Split will convert comma-separated text string and that is what suggested. Seem like that is needed too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

That is why I was asking @amitchandak . If I read @PowerBITesting 's original post correctly, they were getting the column with the red (1) below, and wanted what shows up in column marked with the red (2).
But I still cannot get your solution to replace Text.ToList with Text.Split. It returns an error, and doesn't do the proper replacement of 100 with A, 200, with B, etc.
But I could be wrong. That is why I was asking if you tested it as I'd like to see your solution to better understand. I have been unable to get it to work.
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
01-04-2024 07:57 AM | |||
10-05-2023 07:02 AM | |||
07-10-2024 08:03 AM | |||
10-05-2018 07:25 AM | |||
Anonymous
| 02-26-2024 04:29 PM |
User | Count |
---|---|
84 | |
80 | |
52 | |
37 | |
36 |
User | Count |
---|---|
105 | |
85 | |
48 | |
42 | |
41 |