Forum Discussion

ASingh15's avatar
ASingh15
New Member
3 years ago
Solved

How to display duplicate values from one column based on values in another column

Hello Everyone,

I am new to powerbi and trying to figure out the bese solution for grouping the the values in ID column based on values in the code column. Below is the table for reference.

IDCode
1ABC
1ABC
1ABCD
2ABC
3ABC
4XYZ
4XYZ

This is what I want to display in the table visual:

IDCode
1ABC & ABCD
2ABC
3ABC
4XYZ

Any help is greatly appreciated. Thank you!

  • Hi,

    Please check the below picture and the attached pbix file.

    One of ways is to use CONCATENATEX DAX function in a measure.

     

     

     

    Code measure: =
    IF (
        HASONEVALUE ( Data[ID] ),
        CONCATENATEX ( DISTINCT ( Data[Code] ), Data[Code], " & " )
    )
    

2 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

    One of ways is to use CONCATENATEX DAX function in a measure.

     

     

     

    Code measure: =
    IF (
        HASONEVALUE ( Data[ID] ),
        CONCATENATEX ( DISTINCT ( Data[Code] ), Data[Code], " & " )
    )
    
    • ASingh15's avatar
      ASingh15
      New Member

      Thank you for your prompt response! This solution worked perfectly for my use case. I hope I learn tricks and trade from super users like you. I greatly appreciate your assistance!