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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

group by and then concateate comma separated

Hi, 

I am new to powerbi and using CRM dynamics as datasource.

I have 4 tables, 1) activitypointers, 2) activityparties 3)incident 4) contacts

 

My current table visual is like this 

Ticket Number(incident)Activityid (activitypointer)partyid(activityparty)contact
1axxname
1ayyname
1azzname
2bbbname
3a1x1x1nam
3a2x2x2name

 

All I am expecting it to be is

ticketnmbercontact
1xname, yname, zname
2bname
3x1name, x2name


any help is highly appreciated.

Thanks,

Ashay

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

TomMartens's suggestion is helpful when the columns his formula used are all in the same table.

But, in your scenario, all these four columns are in four different tables.

It seems"incident" table and "contacts" table are not related directly, (from the Relationship view, there is no direct relationship between two tables), 

If your relationship is like

10.png

You could create a column in "contacts" table,

related_ticketnmber = RELATED(incident[Ticket Number])

Then create a measure or use TomMartens's measure

Measure = CONCATENATEX(FILTER(ALL(contacts),contacts[related_ticketnmber]=MAX(contacts[related_ticketnmber])),[contact],",")

9.png

If your relationship is not like that so that you can't create a column as above.

Please let me know what exactly relationships there are.

 

Best regards

Maggie

 

 

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

TomMartens's suggestion is helpful when the columns his formula used are all in the same table.

But, in your scenario, all these four columns are in four different tables.

It seems"incident" table and "contacts" table are not related directly, (from the Relationship view, there is no direct relationship between two tables), 

If your relationship is like

10.png

You could create a column in "contacts" table,

related_ticketnmber = RELATED(incident[Ticket Number])

Then create a measure or use TomMartens's measure

Measure = CONCATENATEX(FILTER(ALL(contacts),contacts[related_ticketnmber]=MAX(contacts[related_ticketnmber])),[contact],",")

9.png

If your relationship is not like that so that you can't create a column as above.

Please let me know what exactly relationships there are.

 

Best regards

Maggie

 

 

Anonymous
Not applicable

Hi Maggie,

Sorry for late reply. 
Actually, I have fixed this by myself. 
Step 1) I created custom column  = Related(contacts(fullname)) .

step 2 ) Created measure = 

Handoff Name = CONCATENATEX(VALUES(activityparties[PartyName]),activityparties[PartyName],", ")

It shows correct data, but I am getting an extra comma at begining of data. 
, Robert David, David Shaw, Morning Evening, Johnathon Arnold, Leslie Fejes

I tried to use Mid function, but after editing formula, visual keeps loading for some time and then shows error msg saying runs out of memory.. 

Any clue on this?? 

Kind Regards,
Ashay
TomMartens
Super User
Super User

Hey,

 

this measure:

concatenax contact = 
IF(HASONEVALUE('Table1'[Ticket Number(incident)])
    ,var tickets= VALUES('Table1'[Ticket Number(incident)])
    return
    CONCATENATEX(
        FILTER(
            ALL(Table1)
            ,'Table1'[Ticket Number(incident)] in tickets
        )
        ,'Table1'[contact]
        ,", "
    )
    ,BLANK()
) 

allows this:

image.png

Hopefully, this is what you are looking for.

 

Regards,
Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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