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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ccolletti
Helper I
Helper I

Combining Data, Separated by a Comma when Matching value in One Column in Power BI Desktop

Hi All,

 

I'm working on building a rollup of data to match Vendors to the State and Store numbers they work in. I was able to pull this data in Excel using TextJoin, but I want to utilize Power BI for when the dataset is refreshed to account for any new stores or vendors.

 

Currently in excel I'm using a similar formula to pull together the state and store numbers and I get the following data.

=TEXTJOIN(", ",TRUE,SORT(UNIQUE(IF('Vendor - Store List'!A:A='Vendor - Store Rollup'!A2,'Vendor - Store List'!C:C,""))))

ccolletti_0-1677262750708.png

 

In Power BI my data reads as the following:

ccolletti_1-1677262879881.png

I've attempted to use CONCATENATEX, CONCATENATEX(VALUES, and SUMMARIZE  from the following link with no results. The data I get back is every store number seperated by a comma for every vendor.

https://community.powerbi.com/t5/Desktop/excel-Text-Join-method-with-Dax/m-p/569470

 

Thank you all for your help and time looking into this!

 

9 REPLIES 9
Padycosmos
Solution Sage
Solution Sage

Padycosmos
Solution Sage
Solution Sage

This video illustrates how to combine rows in Power query

https://drive.google.com/file/d/1na2-YBiK2AGJVbmC85IQiue3E03uVikv/view?usp=share_link

@Padycosmos, unfortunelty I'm unable to access the video due to this being a work computer. Is it possible to post screenshots? Thank you!

Here are the screen shots:

Padycosmos_0-1677607605775.png

Padycosmos_1-1677607633295.png

Padycosmos_2-1677607677862.png

Padycosmos_3-1677607700333.png

 

 

ccolletti
Helper I
Helper I

@sevenhills Thank you for your help, this halfway helped me out.

 

Using the new measure within the table for the State worked perfectly, however the store is still not working correctly. Not sure what I'm missing as I did the fromula exactly how you wrote it out for both and the States came back fine, but the store still just pulled in every single store number.

ccolletti_0-1677599351963.png

 

@ccolletti , the logic is same and not sure where it went wrong. Can you post the DAX?

 

Simple thumb rule: it should work for both the same way. As you have seen, DAX is simple code. All we are doing is getting distinct and concatenex. 

@sevenhills, agreed I figured it would work with State working. And not able to post in DAX, table is locked down by IT. Only have the ability to access the data for design purposes.

It is not possible to help without knowing the table, dax and the issue.

 

Let us do Power Query route:
Ask them to try in Power Query and see if that works there?

 

Say, you have table as below:

sevenhills_0-1677615602724.png

 

Note: Store is marked as text.

 

Add a group by step as below:

= Table.Group(#"Changed Type", {"Vendor"}, 
        {
         {"States", each Text.Combine ( List.Distinct([State], Comparer.OrdinalIgnoreCase), ", "), type text}
         , {"Stores", each Text.Combine ( List.Distinct([Store], Comparer.OrdinalIgnoreCase), ", "), type text}
        })

 

and you can see the output as

sevenhills_1-1677615658581.png

 

Another advantage is Power Query stores, where as Measure calculates in run time. 

Hope this helps!

 

sevenhills
Super User
Super User

Two approaches, you can decided based on your needs.

 

1) Create new DAX table

2) Creating measures in the same table

 

sevenhills_0-1677274279874.png

New Table using DAX:

Table52Vendor_Rollup = 
    Summarize(
        Table52Vendor, Table52Vendor[Vendor], 
           "States", CONCATENATEX(DISTINCT(Table52Vendor[State]), Table52Vendor[State], ", "),
           "Stores", CONCATENATEX(DISTINCT(Table52Vendor[Store]), Table52Vendor[Store], ", ")
    )

 

New Measure within the table

Vendor States = CONCATENATEX(DISTINCT(Table52Vendor[State]), [State], ", ")

Vendor Stores = CONCATENATEX(DISTINCT(Table52Vendor[Store]), [Store], ", ")

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.