Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm running into a problem. I want to count the number of customers who have ordered a certain set of clothes in their orders.
I at first made the following expression:
count({$<%ARTICLE_VARIANT = {'A','B*','C','D'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'A'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'B*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'C'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)
>} DISTINCT CUSTOMER)
This gives me the number of customers who ordered all these articles. Now I have another set of different articles I would like to calculate as well. IE:
count({$<%ARTICLE_VARIANT = {'D','E*','F','G'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'E*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'F'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'G'}>} CUSTOMER)
>} DISTINCT CUSTOMER)
Now if I just sum these calculations I run into a problem. The result of the first can be 4 customers and of the second can be 4 customers, so the result would be 8. But what if a single customer ordered both sets. The result should be 7 instead of 8. How can I do this?
Maybe try to create a combined set the contains both customer sub sets, then do the DISTINCT count:
count(
{$<%ARTICLE_VARIANT = {'A','B*','C','D'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'A'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'B*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'C'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)
>
+
<%ARTICLE_VARIANT = {'D','E*','F','G'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'E*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'F'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'G'}>} CUSTOMER)
>}
DISTINCT CUSTOMER)
Check out this description:
Maybe try to create a combined set the contains both customer sub sets, then do the DISTINCT count:
count(
{$<%ARTICLE_VARIANT = {'A','B*','C','D'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'A'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'B*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'C'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)
>
+
<%ARTICLE_VARIANT = {'D','E*','F','G'}, CUSTOMER =
p({$<%ARTICLE_VARIANT = {'D'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'E*'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'F'}>} CUSTOMER)*
p({$<%ARTICLE_VARIANT = {'G'}>} CUSTOMER)
>}
DISTINCT CUSTOMER)
This worked! Thanks!