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 August 31st. Request your voucher.

Reply
cristianabraga
Frequent Visitor

DAX NEW Column to join values by comma

Hello,

 

I have a table with the following format:

 

PK1, Value1

PK1, Value2

PK2, Value1

PK2, Value3

 

How to create in DAX a column with all the distict values separated by comma that are assoiated with the pk?

 

PK1, Value1, "Value1,Value2"

PK1, Value2, "Value1,Value2"

PK2, Value1, "Value1,Value3"

PK2, Value3, "Value1,Value3"

PK3, Value4, "Value4"

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @cristianabraga ,

 

You can try this code to create a calculated column.

Combine by PK =
CONCATENATEX (
    FILTER ( 'Table', 'Table'[PK] = EARLIER ( 'Table'[PK] ) ),
    [Value],
    ","
)

Result is as below.

RicoZhou_0-1671070477424.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
cristianabraga
Frequent Visitor

thank you, it works

Anonymous
Not applicable

Hi @cristianabraga ,

 

You can try this code to create a calculated column.

Combine by PK =
CONCATENATEX (
    FILTER ( 'Table', 'Table'[PK] = EARLIER ( 'Table'[PK] ) ),
    [Value],
    ","
)

Result is as below.

RicoZhou_0-1671070477424.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.