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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Trying to return comma separated values from filtered related records in a column

I am trying to find the right formula in DAX for this and getting nowhere.

 

I have two tables:

 

  1. The first table is Projects, this has a ProjectID column, and many others.
  2. The second table is Contacts related to projects, which also has a ProjectID column, which is used to relate contacts to projects many to one. There is also a Role column and a Name column on the Contact table.

 

I need to create a column on the Projects table which shows, in a comma separated list, the Names of all the contacts where 1) ProjectID on the Contact = ProjectID on the Project, and 2) the Role value for that row of the Contact table contains a certain string.

 

I have used CALCULATE successfully to do the same kind of thing, summing values on a related table with multiple filter criteria applied to which rows are included, but I'm failing on getting text values concatenated into a comma separated string in the same way.

 

I need something that works exactly like:

 

CALCULATE(SUM(column),
FILTER(criteria),
FILTER(criteria),
FILTER(criteria)
)

 

Except instead of SUM, it returns a text string with all the names that match the criteria. I've been playing with VALUES and CONCATENATEX, but I can't get the syntax to work.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a new column in project table

concatenatex(filter(Contract, contract[project id] = project[project id]),[contract id])

 

refer: https://docs.microsoft.com/en-us/dax/concatenatex-function-dax

https://www.youtube.com/watch?v=du2HSEzng2E

 

correct column name as per need

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@amitchandak That did it for a single filter criteria--thank you!

 

What's the best way to do it with multiple fitlers? I just nested a second FILTER within the first, and that seems to work. Is there a more elegant and easier to read method?

amitchandak
Super User
Super User

@Anonymous , Create a new column in project table

concatenatex(filter(Contract, contract[project id] = project[project id]),[contract id])

 

refer: https://docs.microsoft.com/en-us/dax/concatenatex-function-dax

https://www.youtube.com/watch?v=du2HSEzng2E

 

correct column name as per need

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.

Top Solution Authors