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

How to concatenate a list of products by customer (product combos)

Hello, I have of list of transactions by customers like this:

Customer IDProduct
1A
1B
1C
2A
3A
3C
4A
4D
5

B

 

I need to figure out the combinations of products by customer, something like this:

Customer IDProduct Combo
1A, B, C
2A
3A, C
4A, D

Also, I would like to be able to filter this product combos considering just customers who bought product "A" or product "A" and other.

 

Finally, I expect to have a visualization with this information:

Top Product CombosTop Product Combos
A, B56
A, C34
A23
A, D16

Top product combos is the frequence in which a customer buys "A,B".

 

 

Thank you in advance 🙂

1 ACCEPTED SOLUTION

Hi @danielgnic ,

I have created a simple smaple, please refer to it to see if it helps you.

Create a column first.

Column = VAR _1= CONCATENATEX(FILTER('Table','Table'[customer id]=EARLIER('Table'[customer id])),'Table'[product],",")
RETURN
IF(CONTAINSSTRING(_1,"A"),_1,BLANK())

Then create a measure.

Measure = CALCULATE(DISTINCTCOUNT('Table'[customer id]),FILTER(ALL('Table'),'Table'[Column]=SELECTEDVALUE('Table'[Column])))

vpollymsft_0-1678670418112.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

3 REPLIES 3
v-rongtiep-msft
Community Support
Community Support

Hi @danielgnic ,

Sorry I am foolish. In the last table the value of A,B is 56, how is it calculated? And there is the value A,B,C in the second table, why it disappeared in the last table? I can understand the data in the second table, but I am very confused about the third table.

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Hello, @v-rongtiep-msft , thank you for your reply. The numbers in the last table were an example, I'm sorry for not being totally clear about it. Concerning the "A, B, C" combo, you're right, it disappeared but I didn't mean to do it lol. 

 

This is what I have:

danielgnic_4-1678459209730.png

 

And this is what I would like to calculate:

danielgnic_2-1678459163951.png

IAs you can see, I'm not counting customer 4 because they didn't buy product A

 

And finally:

danielgnic_3-1678459177127.png

 

 

 

Hi @danielgnic ,

I have created a simple smaple, please refer to it to see if it helps you.

Create a column first.

Column = VAR _1= CONCATENATEX(FILTER('Table','Table'[customer id]=EARLIER('Table'[customer id])),'Table'[product],",")
RETURN
IF(CONTAINSSTRING(_1,"A"),_1,BLANK())

Then create a measure.

Measure = CALCULATE(DISTINCTCOUNT('Table'[customer id]),FILTER(ALL('Table'),'Table'[Column]=SELECTEDVALUE('Table'[Column])))

vpollymsft_0-1678670418112.png

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

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.