Build String from Rows using DAX

Hi,

I need help with building string from a row using DAX.
For example, I have the following table with 2 columns ID and Value.

image

Instead of having values in the row, is there any way I can combine them in a string based on the ID. For instance, ID 101 should have values in the following format: 15000, 150001, 15002 (merged in 1 row separated by comma).

The result should look like:

image

Please advise…

Thank you!

1 Like

Hi @gkhokher

See attached PBIX.
You needed the CONCATENATEX function

Pete
ConcatenateX.pbix (16.7 KB)

2 Likes

Hi @BINavPete ,

Thank you very much for the solution.
I am having an issue implementing this.
I am getting duplicated values in the string. My original table has something like below with a unique value column (column2) and the Value column has duplicated values. So, I am getting duplicated values in string. I cannot “Remove Duplicates” as column2 has unique values.

image

Duplicated values result:

image

Is there any way to get only the unique values in the string and remove the duplicated values?
I have attached the .pbix file.
Please advise…

Thank you!

ConcatenateX.pbix (20.1 KB)

1 Like

Hi @gkhokher

You needed to amend the function with DISTINCT to get a unique table of values to concatenate through.

See fresh PBIX
Pete
ConcatenateX.pbix (20.2 KB)

1 Like

Thanks @BINavPete , It is working now.