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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jbbcormed
Frequent Visitor

remove distinct values from row within a column

I am trying to remove repeated values from a column
that has comma seperated values (Ex, 1,3,4,6,7,9,9,9,9) should return (1,3,4,5,6,9)

 

 I found a match for my issue on stack overflow, which works in the example format, but when I try to apply to my query, I don't understand how to reference a specific column from my source. Would anyone be able to demonstrate to me how to fix this syntax? Thank you. 

https://stackoverflow.com/questions/70576109/how-to-remove-duplicates-in-a-text-string-with-power-qu...

 

The example: 

 

let
Source = "Giang.Phan@abc.com, thao.tran@abc.com, Khoa.Vu@abc.com, Vn.Offset@abc.com, Giang.Phan@abc.com, thao.tran@abc.com, Khoa.Vu@abc.com, Vn.Offset@abc.com",
#"Distinct Values" = Text.Combine(List.Distinct(Text.Split(Source, ", ")),", ")
in
#"Distinct Values"

 

The example above works

 

My source contains multiple columns, so I tried to reference the column from source like this - 

 

= Text.Combine(List.Distinct(Text.Split(#"PREVIOUS STEP"{"MY COLUMN NAME"}, ",")),",")

 

 

let
Source = <A BUNCH OF COLUMNS HERE>,
#"Remove Duplicates" = Text.Combine(List.Distinct(Text.Split(Source{"MY COLUMN NAME"}, ",")),",")
in
#"Remove Duplicates"

 

jbbcormed_0-1710782628658.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@jbbcormed Try adding a custom column like this:

=Text.Combine(List.Distinct(Text.Split([YOUR COLUMN NAME], ", ")),", ")

 

You can then remove the original column.



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...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@jbbcormed Try adding a custom column like this:

=Text.Combine(List.Distinct(Text.Split([YOUR COLUMN NAME], ", ")),", ")

 

You can then remove the original column.



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...

Oh my gosh, I don't know why that threw me for a loop, worked like a champ, this is like when I realize I should be doing a calculated column instead of a measure in DAX. "When it no worky, consider you are doing it in the wrong place" haha

 

Edit: And THANK YOU!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors