cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Intersections of customer product purchases

Hi

 

I need help with producing a count of the intersections bewteen customers and which items they have purchased. For example, if there are 5 products, a customer can purchase any single product or any combination of the 5. Customers can also re-purchase a product at any date - this is where my problem arises as an end user wants to be able to see the intersections for any selected date range.

 

I have managed to come up with a solution which includes the use of parameters but this is not ideal as the end user does not have access to change any parameters of the report.

 

I'm open to any solution that does not involve parameters, ideally a slicer with dates would be the best solution

 

The fields I have on the table are customer_ID, date_ID and product

 

Example Data

Data.PNG

 

Possible output with different slicer selections

 

Output.PNG

 

This is my first post so please don't hesitate to ask if I need to provide any more information that would help with a solution

 

Any help at all would be greatly appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Intersections of customer product purchases

Hi,

 

AFAIK, current power bi not support to use slicer/filter to create dynamic calculated column/table. (Measure is possible to achieve this, but it not support to use as category)

 

So I think it is impossible to dynamic generate output table based on selection.

 

Sample measures:

Product List =
CALCULATE (
    CONCATENATEX ( VALUES ( Table1[product] ), [product], "," ),
    VALUES ( Table1[customer_id] )
)


Product/Custom Detail = 
VAR temp =
    SUMMARIZE (
        ALLSELECTED ( Table1 ),
        [customer_id],
        "Product Combo", CONCATENATEX ( VALUES ( Table1[product] ), [product], "," )
    )
VAR t2 =
    SUMMARIZE (
        temp,
        [Product Combo],
        "Customer list", CONCATENATEX (
            FILTER ( temp, [Product Combo] = EARLIER ( [Product Combo] ) ),
            [customer_id],
            ","
        )
    )
RETURN
    CONCATENATEX ( t2, [Product Combo] & ":" & [Customer list], "|" )

8.PNG

9.PNG

 

Regards,
Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Intersections of customer product purchases

Hi,

 

AFAIK, current power bi not support to use slicer/filter to create dynamic calculated column/table. (Measure is possible to achieve this, but it not support to use as category)

 

So I think it is impossible to dynamic generate output table based on selection.

 

Sample measures:

Product List =
CALCULATE (
    CONCATENATEX ( VALUES ( Table1[product] ), [product], "," ),
    VALUES ( Table1[customer_id] )
)


Product/Custom Detail = 
VAR temp =
    SUMMARIZE (
        ALLSELECTED ( Table1 ),
        [customer_id],
        "Product Combo", CONCATENATEX ( VALUES ( Table1[product] ), [product], "," )
    )
VAR t2 =
    SUMMARIZE (
        temp,
        [Product Combo],
        "Customer list", CONCATENATEX (
            FILTER ( temp, [Product Combo] = EARLIER ( [Product Combo] ) ),
            [customer_id],
            ","
        )
    )
RETURN
    CONCATENATEX ( t2, [Product Combo] & ":" & [Customer list], "|" )

8.PNG

9.PNG

 

Regards,
Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 6 members 4,654 guests
Please welcome our newest community members: