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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Extract unordered comma delimeted data into columns containing identical data in Power Query

Hi guys, 

 

I'm relatively new to Power BI and I have encountered an issue that I hope you can help me resolve. 

 

I have several columns which contains rows that could look like below. 

Row1: 401,402,403

Row2: 405,403,407,408

Row3: 403,405,404,410,406,402

Etc. 

 

My issue is that I want to create new columns that either gives the value "1" if e.g. 401 is present in the row or extracts the value 401 to a new column that only contains the values 401 or "Null". 

 

If I use the Extract or Split by delimiter function I will get a column containing the values 401, 405 and 403 in this example. 

 

My data is connected to Dynamics through an API so the columns should be able to update accordingly. 

 

I hope the above makes some sense. Thanks in advance guys.

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Add the following formula to a customer column. It splits the line into a list based on a comma. List.Contains then tests to see if the value 401 is in the list.

 

if List.Contains(Text.Split([Line],","),"401") then 1 else null

 

 

View solution in original post

v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is that your excepted result?

 

Capture.PNG

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjEw1DExMAJiY6VYHRDfFMQGYnMgtoCKgfggcRMdE0MDIG0G0qMUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each if List.Contains(Text.Split([Column1],","),"401") then 1 else null)
in
    #"Added Custom"
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is that your excepted result?

 

Capture.PNG

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjEw1DExMAJiY6VYHRDfFMQGYnMgtoCKgfggcRMdE0MDIG0G0qMUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each if List.Contains(Text.Split([Column1],","),"401") then 1 else null)
in
    #"Added Custom"
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Add the following formula to a customer column. It splits the line into a list based on a comma. List.Contains then tests to see if the value 401 is in the list.

 

if List.Contains(Text.Split([Line],","),"401") then 1 else null

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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