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

Concate Customer Wise

Dear All,

I am using this below Dax query to concate the items for each customer bought in the same month.

Combine = CONCATENATEX (SUMMARIZE (
FILTER ( 'ID-Item','ID-Item'[BillId]=EARLIER('ID-Item'[BillId])),
'ID-Item'[Item ],'ID-Item'[CustomerId]
),'ID-Item'[Item ],",")
 
 
I am getting results as below which is bill wise concate that is wrong:
Item BillIdCustomerIdMonthCombine
chicken1abcJanchicken
chicken3xyzJanchicken,Eggs
chicken6polJanchicken,Mutton,Eggs
chicken7satJanchicken
chicken10abcFebchicken
Mutton2abcJanMutton
Mutton4sabJanMutton
Mutton6polJanchicken,Mutton,Eggs
Mutton8satJanMutton
Eggs3xyzJanchicken,Eggs
Eggs5frqJanEggs
Eggs6polJanchicken,Mutton,Eggs
Eggs9batJanEggs
Eggs11abcFebEggs

 

 

I need customer wise Concate not bill wise as below result:

Item BillIdCustomerIdMonthCombine
chicken1abcJanchicken,Mutton
chicken3xyzJanchicken,Eggs
chicken6polJanchicken,Mutton,Eggs
chicken7satJanchicken,Mutton
chicken10abcFebchicken,Eggs
Mutton2abcJanchicken,Mutton
Mutton4sabJanMutton
Mutton6polJanchicken,Mutton,Eggs
Mutton8satJanchicken,Mutton
Eggs3xyzJanchicken,Eggs
Eggs5frqJanEggs
Eggs6polJanchicken,Mutton,Eggs
Eggs9batJanEggs
Eggs11abcFebchicken,Eggs
Please help me in correction of this Dax
thanks
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can update your calculated column [Combine] as below to get customer wise combination:

Combine =
CONCATENATEX (
FILTER (
'ID-Item',
'ID-Item'[CustomerId] = EARLIER ( 'ID-Item'[CustomerId] )
&& 'ID-Item'[Month] = EARLIER ( 'ID-Item'[Month] )
),
'ID-Item'[Item],
","
)

yingyinr_1-1643779199924.png

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can update your calculated column [Combine] as below to get customer wise combination:

Combine =
CONCATENATEX (
FILTER (
'ID-Item',
'ID-Item'[CustomerId] = EARLIER ( 'ID-Item'[CustomerId] )
&& 'ID-Item'[Month] = EARLIER ( 'ID-Item'[Month] )
),
'ID-Item'[Item],
","
)

yingyinr_1-1643779199924.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Combine = CONCATENATEX (SUMMARIZE (
FILTER ( allselected('ID-Item'),'ID-Item'[BillId]=Max('ID-Item'[BillId])),
'ID-Item'[Item ],'ID-Item'[CustomerId]
),'ID-Item'[Item ],",")

Anonymous
Not applicable

Dear @amitchandak 
I am getting this error while using your DAX query.
Please correct it.
Thanks

Shafe_0-1643273401848.png

 

@Anonymous , Oh, you are trying a column. Try like

 

Combine = CONCATENATEX (
FILTER ( allselected('ID-Item'),'ID-Item'[BillId]=earlier('ID-Item'[BillId])),'ID-Item'[Item ],",")

Anonymous
Not applicable

@amitchandak 
i am getting below result :

Item BillIdCustomerIdMonthCombine

chicken1abcJanchicken
chicken3xyzJanchicken-Eggs
chicken6polJanchicken-Mutton-Eggs
chicken7satJanchicken
chicken10abcFebchicken
Mutton2abcJanMutton
Mutton4sabJanMutton
Mutton6polJanchicken-Mutton-Eggs
Mutton8satJanMutton
Eggs3xyzJanchicken-Eggs
Eggs5frqJanEggs
Eggs6polJanchicken-Mutton-Eggs
Eggs9batJanEggs
Eggs11abcFebEggs

I need customer wise combination.
Please check my required result in the question.

Thanks

Anonymous
Not applicable

@amitchandak 
I am still getting an error.

 

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.