Segmenting users

I have a purchase database where I use customerId as the customer identifier and category as the purchase type identifier.

A user from one category can also purchase from other categories.

I want to present a table with the segmentation of users who purchased in category A, but analyze their behavior across all categories (B,C,D…).

How can I filter users who use one category without limiting the analysis only to the category they purchased from? In other words, I want to answer questions like: users from category B have also purchased in categories C and D.

I cannot filter by category because then it only shows the category they purchased from and not the other categories they have bought in.

If something like this were possible, I think it could solve the issue, but it’s not possible at the moment:

users_categoryA = distinct_countIf(customerId, Category = 'A', [customerId])

and then filter using:

users_categoryA >= 1

Hi @KLIKIN,

I believe you will be able to achieve your intended behavior by using a calculated field like the example below:

maxOver(
    ifelse(category = 'A', 1, 0),
    [customerId],
    PRE_AGG
)

This calculated field should allow you to pull all the category appearances for each customer while raising 1 for all the respective instances due to the maxOver. From there, if you filter based on if that calculated field = 1, you should only see Category A customers’ general category behavior.

Let me know if this approach works or if you have any other specific questions! If not, please feel free to let us know and we can see if there is another workaround!

Works perfectly, thank you very much