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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors