Forum Discussion

WillT's avatar
WillT
Icon for Community Admin rankCommunity Admin
10 years ago

Customers who bought multiple products

Hi everyone. Worked on a little problem recently to try and figure out "customers who bought combinations of products". I have seen plenty of posts and great patterns on Basket Analysis (e.g. DAX Patterns, Chris Webb etc.) but they were always about a max of two products and used a pattern with multiple 'dimension' tables and meant you had to deal with inactive relationships.

 

We found a nice way of simplifying this so with one slicer you can select a few products and see how many people bought all of those products, and how many bought any of them:

 

https://app.powerbi.com/view?r=eyJrIjoiMmQ0OWYzYmQtNjhjNC00OGRiLWEzNGQtNGZjYWU4YWQzMTg1IiwidCI6ImFmZGIzOGQ2LTI0MTgtNDQyYS1hMDI1LWYwODY3MWYzMDRjYiIsImMiOjZ9 

 

 You can get the pbix file here:

https://1drv.ms/u/s!AhrHQG3fCq7Rsu0Z8MhPKuWN3nkt6A

 

Hope you find it useful!

 

10 Replies

  • Vvelarde's avatar
    Vvelarde
    Icon for Community Champion rankCommunity Champion

    Hi, In the PowerBI Sample you can't select more than 1 product.

     

    EDIT: Sorry, Its correct.

     

     

    • Sean's avatar
      Sean
      Icon for Community Champion rankCommunity Champion

      Vvelarde Not sure what you mean - you can CTRL select or just turn off single select (in the pbix file)

       

      EDIT: CTRL Select works on the published report

       

      • Sean's avatar
        Sean
        Icon for Community Champion rankCommunity Champion

        Here's the Measure for everyone to see!

         

        Buyers of All Selected Products =
        IF (
            ISBLANK (
                COUNTROWS (
                    FILTER (
                        SUMMARIZE (
                            Sales,
                            Sales[Customer],
                            "ProductsBought", DISTINCTCOUNT ( Sales[Product] )
                        ),
                        [ProductsBought] = COUNTROWS ( VALUES ( Sales[Product] ) )
                    )
                )
            ),
            0,
            COUNTROWS (
                FILTER (
                    SUMMARIZE (
                        Sales,
                        Sales[Customer],
                        "ProductsBought", DISTINCTCOUNT ( Sales[Product] )
                    ),
                    [ProductsBought] = COUNTROWS ( VALUES ( Sales[Product] ) )
                )
            )
        )

         

        Thanks to WillT :smileyhappy:

  • Hi,

     

    I have a similar request, but my users want to see the customer list and the amounts per product as well in a pivot table

    My data has Columns: Year, Customer No, Customer Name, Product, and Amount.

    I'm thinking if I can get a unique customer list in a calculated table dynamically based on the product selection and year selection, I can use the relations between the table and get the visualizations working.

     

    Could someone kindly help in getting this dynamic table? Even if anyone has a better solution, I would be more than happy to take it. 

     

    Thank You & Regards,

    Krishna Kalyan