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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Summarizing/grouping together columns

Hi all, have a table of customers, some of which have multiple Customer IDs (like Microsoft in the sample table), but I really would like to classify this as one customer. I'd like to group customers by Customer Name only if the Regions are the same by creating the Modified Customer ID column, which should include a list of unique Customer IDs separated by a comma.

 

So, in this case, Microsoft would be a customer I'd want to group into 1 customer because it has the same region for all Customer IDs, but I would not want to group Amazon as 1 customer because one is in Europe and one is in the US. Please comment if you have any ideas!

 

Customer IDCustomer NameProduct PurchasedRegionModified Customer ID (Desired Column) 
124MicrosoftCloudUS124, 125, 126
124MicrosoftCloudUS124, 125, 126
125MicrosoftData CenterUS124, 125, 126
126MicrosoftData CenterUS124, 125, 126
223AmazonCloudUS223
224AmazonCloudEurope224

 

Screen Shot 2020-05-21 at 9.52.20 AM.png

3 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

If I understand correctly, perhaps:

 

 

Column =
  CONCATENATEX(
    FILTER('Table',[Customer Name] = EARLIER([Customer Name]) && [Region] = EARLIER([Region]))
    [Customer ID],", "
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this one:

Column =
VAR _customer = CALCULATETABLE(DISTINCT('Table'[Customer ID]), FILTER('Table', 'Table'[Region] = EARLIER('Table'[Region]) && 'Table'[Customer Name] = EARLIER('Table'[Customer Name])))
RETURN CONCATENATEX(_customer, 'Table'[Customer ID], ",")
 
Capture.PNG


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

Proud to be a Super User!



View solution in original post

ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

Measure solution attempt:

Measure Modified Customer ID = 
IF (
    ISFILTERED ( 'TableName'[Customer Name] ),
    CALCULATE (
        CONCATENATEX (
            DISTINCT ( TableName[Customer ID] ),
            TableName[Customer ID],
            ", "
        ),
        ALLEXCEPT ( 'TableName', 'TableName'[Customer Name], 'TableName'[Region] )
    ),
    BLANK ()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

3 REPLIES 3
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous -

Measure solution attempt:

Measure Modified Customer ID = 
IF (
    ISFILTERED ( 'TableName'[Customer Name] ),
    CALCULATE (
        CONCATENATEX (
            DISTINCT ( TableName[Customer ID] ),
            TableName[Customer ID],
            ", "
        ),
        ALLEXCEPT ( 'TableName', 'TableName'[Customer Name], 'TableName'[Region] )
    ),
    BLANK ()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this one:

Column =
VAR _customer = CALCULATETABLE(DISTINCT('Table'[Customer ID]), FILTER('Table', 'Table'[Region] = EARLIER('Table'[Region]) && 'Table'[Customer Name] = EARLIER('Table'[Customer Name])))
RETURN CONCATENATEX(_customer, 'Table'[Customer ID], ",")
 
Capture.PNG


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

Proud to be a Super User!



Greg_Deckler
Community Champion
Community Champion

If I understand correctly, perhaps:

 

 

Column =
  CONCATENATEX(
    FILTER('Table',[Customer Name] = EARLIER([Customer Name]) && [Region] = EARLIER([Region]))
    [Customer ID],", "
  )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.