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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ChPetru
Helper I
Helper I

How many customers have bought same product combination

Hi guys,

 

Need help with calculation how many customers have bought the same combination of products.

In the below example both customers A and D have purchased same products (Products: 1,2,3 and 4).

How can I find this count in PowerBI? My first thought is by creating a key for each unique product combination (not sure how the dax code would look for that) and then simply do customer count for each of those keys,.

 

CustomerProduct
Customer AProduct 1
Customer AProduct 2
Customer AProduct 3
Customer AProduct 4
Customer BProduct 5
Customer BProduct 6
Customer BProduct 7
Customer BProduct 8
Customer BProduct 2
Customer CProduct 3
Customer CProduct 4
Customer CProduct 5
Customer CProduct 6
Customer DProduct 1
Customer DProduct 2
Customer DProduct 3
Customer DProduct 4

 

Please help!

1 ACCEPTED SOLUTION
mh2587
Super User
Super User

Summary Table =
var temp= SUMMARIZE(Sheet5,Sheet5[Customer],"Combinations",CONCATENATEX(FILTER(SUMMARIZE(Sheet5,[Customer],Sheet5[Type]),Sheet5[Customer]=EARLIER(Sheet5[Customer])),[Type]&","))
return
SUMMARIZE(temp,[combinations],"Number",COUNTAX(FILTER(temp,[combinations]=EARLIER([combinations])),[Customer]))

Modify It According to your needs


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

6 REPLIES 6
mh2587
Super User
Super User

Summary Table =
var temp= SUMMARIZE(Sheet5,Sheet5[Customer],"Combinations",CONCATENATEX(FILTER(SUMMARIZE(Sheet5,[Customer],Sheet5[Type]),Sheet5[Customer]=EARLIER(Sheet5[Customer])),[Type]&","))
return
SUMMARIZE(temp,[combinations],"Number",COUNTAX(FILTER(temp,[combinations]=EARLIER([combinations])),[Customer]))

Modify It According to your needs


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi mh2587, thank you for the help, it works, however I am now unable to link the summarized table to the existing fact table (to be able to set filters on date or bring some other columns like the customer name for some investigation). Any idea on how I acomplish this?

would you please share the model


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



apologies, the data is confidential but here's how the two tables look in the model:

ChPetru_0-1645625734433.png

 

I have the summary table you suggested and need a way to see all the Opportunities that belong under each "combination".

Also, I will need to filter the Summary table by a specific "Opportunity Close Date", column that belongs to the fact table.

 

Is there a way I can make a relationship between the two tables? Or make the summary table as columns on the fact table?

thank you, it works! now only thing i have to do is find a way to link it to the other tables 🙂

mh2587
Super User
Super User

Check this one hope it will suit your requirements 

https://www.daxpatterns.com/basket-analysis/


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.