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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Iamnvt
Continued Contributor
Continued Contributor

Remove duplicate values after separator in Calculated Column

hi,

 

I need to use DAX calculate column function to remove the dupplicate value:

 

InputExpected Output
A, A, BA, B
B, B, CB, C

 

how to do this?

thanks

 

1 ACCEPTED SOLUTION

Hey @Iamnvt ,

 

in Power Pivot you are able to use the CALENDAR function as is described here:

https://www.sqlbi.com/articles/generating-a-series-of-numbers-in-dax/

 

Here is the DAX statement from above now using the function CALENDAR:

 

output calendar = 

var _in = 'Table'[input]
var _inAsPath = SUBSTITUTE(_in , ", " , "|")
var _inPathLength = PATHLENGTH(_inAsPath)
var _T = DISTINCT(SELECTCOLUMNS(ADDCOLUMNS(SELECTCOLUMNS(CALENDAR(1 , _inPathLength), "_Value", INT(''[Date])), "@item", PATHITEM(_inAsPath , [_Value] , TEXT)) , "@@item", [@item]))
return
CONCATENATEX(_T ,  [@@item], ", ")

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey @Iamnvt ,

 

you can use this DAX to create a calculated column:

output = 
var _in = 'Table'[input]
var _inAsPath = SUBSTITUTE(_in , ", " , "|")
var _inPathLength = PATHLENGTH(_inAsPath)
var _T = CONCATENATEX(DISTINCT(SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1 , _inPathLength) , "@PathItem" , PATHITEM(_inAsPath , [Value] , TEXT)) , "@@pahItme" , [@PathItem])), [@@pahItme] , ", ")
return
_T 

This is how it looks like:

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Iamnvt
Continued Contributor
Continued Contributor

@TomMartens  thanks for the answer

 

DAX in Power Pivot doesn't have GENERATESERIES function. 

is there any other way around?

Hey @Iamnvt ,

 

in Power Pivot you are able to use the CALENDAR function as is described here:

https://www.sqlbi.com/articles/generating-a-series-of-numbers-in-dax/

 

Here is the DAX statement from above now using the function CALENDAR:

 

output calendar = 

var _in = 'Table'[input]
var _inAsPath = SUBSTITUTE(_in , ", " , "|")
var _inPathLength = PATHLENGTH(_inAsPath)
var _T = DISTINCT(SELECTCOLUMNS(ADDCOLUMNS(SELECTCOLUMNS(CALENDAR(1 , _inPathLength), "_Value", INT(''[Date])), "@item", PATHITEM(_inAsPath , [_Value] , TEXT)) , "@@item", [@item]))
return
CONCATENATEX(_T ,  [@@item], ", ")

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.