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
admincaleb007
Frequent Visitor

Concatenate with Filter

Not sure why my query isn't working.

I have a table (products-master) with cols productname, user.email, user.role

ProductNameuser.emailuser.role
productAmyemail@site.commanager
productAmyemail2@site.commanager
productAmyemail3@site.comuser
productByouremail@site.commanager
productByouremail2@site.comuser
productByouremail3@site.com

manager

 

I'm trying to concatenate all of the manager emails into one row per distinct(ProductName).  The above table would look like this after I'm done with a quick calculated column:

 

ProductNameuser.emailuser.roleCalc.Col
productAmyemail@site.commanagermyemail@site.com, myemail2@site.com
productByouremail@site.commanageryouremail@site.com, youremail3@site.com

 

I created a second table with only ProductName (products-child), and added only productA, productB, as values (not sure why I did this but after many failed queries I made, this is what I did but still failed.  Not even sure if necessary).  If second table is just pointless then great; I'll keep one table.  This is a very small dataset, and now I'm really curious how to solve this, and why my query isn't working.

 

colum = CONCATENATEX(
filter(
relatedtable('products-child'),
'products-master'[user.role]="manager"
),'products-master'[user.email],", ")
 
The above query just brings together ALL emails per PRODUCT and does not seem to be filtering based on the role I'm looking for (manager).
 
Any help would be great.
1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @admincaleb007 ,

 

Based on this——I'm trying to concatenate all of the manager emails into one row per distinct(ProductName).  And if you do not want to create a new table, Please try to create a measure:

Manager = 
var _t=SUMMARIZE(FILTER('Table',[user.role]="manager"),'Table'[ProductName],[user.email])
return CONCATENATEX(FILTER(_t,[ProductName]=MAX('Table'[ProductName])),[user.email]," , ")

Output:

Eyelyn9_0-1649148791680.png

Best regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @admincaleb007 ,

 

Based on this——I'm trying to concatenate all of the manager emails into one row per distinct(ProductName).  And if you do not want to create a new table, Please try to create a measure:

Manager = 
var _t=SUMMARIZE(FILTER('Table',[user.role]="manager"),'Table'[ProductName],[user.email])
return CONCATENATEX(FILTER(_t,[ProductName]=MAX('Table'[ProductName])),[user.email]," , ")

Output:

Eyelyn9_0-1649148791680.png

Best regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @admincaleb007 ,

 

do you mean like this? See attached file.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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