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
hasarinfareeth
Frequent Visitor

Concatenate column with a row identifier

Hi 

 

I have the data source as below in which I need to concatenate a specific column based on the row identifier.  Can you please help me in acxhiving this through DAX?

 

S NoNamePurchased Item
1SamCloth
2ChrisFood
1SamGift
3PeterShoes
2ChrisTickets
4DeanFlowers
3PeterCandy

 

Expected Result:

 

S NoNamePurchased Items - Concatenated
1SamCloth, Gift
2ChrisFood, Tickets
3PeterShoes, Candy
4DeanFlowers
2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@hasarinfareeth,

 

Try this measure:

 

Purchased Items - Concatenated = 
CONCATENATEX ( SUMMARIZE ( 'Table', 'Table'[S No], 'Table'[Purchased Item] ), 'Table'[Purchased Item], ", " )

 

DataInsights_0-1738426797829.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

divyed
Super User
Super User

Hello @hasarinfareeth ,

 

Use below dax for your purpose :

This will be slightly better in performance than SUMMERIZE.

GROUPBY

This function works similarly to SUMMERIZE , but instead of calculating aggregations, it just groups by the specified columns. Since you're not performing any aggregation (like summing or counting), GroupBY can be more direct and semantically cleaner in this context.

 

Purchased Items - Concatenated =
CONCATENATEX (
    SUMMARIZE (
        'Table',
        'Table'[SNO],
        "ConcatenatedItems",
        CONCATENATEX (
            FILTER (
                'Table',
                'Table'[SNO] = EARLIER('Table'[SNO])
            ),
            'Table'[Purchased_Item],
            ", "
        )
    ),
    [ConcatenatedItems],
    ", "
)
 
divyed_0-1738496416445.png

 

I hope this helps.

 

Did I answer your query ? Mark this as solution if this helps.

 

Warm Regards,

Neeraj Kumar

 

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/

View solution in original post

2 REPLIES 2
divyed
Super User
Super User

Hello @hasarinfareeth ,

 

Use below dax for your purpose :

This will be slightly better in performance than SUMMERIZE.

GROUPBY

This function works similarly to SUMMERIZE , but instead of calculating aggregations, it just groups by the specified columns. Since you're not performing any aggregation (like summing or counting), GroupBY can be more direct and semantically cleaner in this context.

 

Purchased Items - Concatenated =
CONCATENATEX (
    SUMMARIZE (
        'Table',
        'Table'[SNO],
        "ConcatenatedItems",
        CONCATENATEX (
            FILTER (
                'Table',
                'Table'[SNO] = EARLIER('Table'[SNO])
            ),
            'Table'[Purchased_Item],
            ", "
        )
    ),
    [ConcatenatedItems],
    ", "
)
 
divyed_0-1738496416445.png

 

I hope this helps.

 

Did I answer your query ? Mark this as solution if this helps.

 

Warm Regards,

Neeraj Kumar

 

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
DataInsights
Super User
Super User

@hasarinfareeth,

 

Try this measure:

 

Purchased Items - Concatenated = 
CONCATENATEX ( SUMMARIZE ( 'Table', 'Table'[S No], 'Table'[Purchased Item] ), 'Table'[Purchased Item], ", " )

 

DataInsights_0-1738426797829.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.