Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have the following table.
load * Inline
[
CountMemberId,Category
1,A
1,A
2,C
2,A
3,A
]
I want to use an expression to show how many members have bought at leaset 2 products whose category is A.
For this test, only one whose ID is 1.
How to finish it?
Hello,
Use
Count({< CountMemberId = {"=Count({< Category = {'A'} > + < Category = {'C'} >} CountMemberId) > 1"} >} DISTINCT CountMemberId)
That will return "1" for those CountMemberId who have bought either 2 "A" or 2 "C".
Hope that helps.
Hello Isaac,
I'd use something like
Count({< CountMemberId = {"=Count({< Category = {'A'} >} CountMemberId) > 1"} >} DISTINCT CountMemberId)
Hope that helps.
Yes, it works, you are always my teacher.
Now I have an additional question on it.
If I want to get the nums who bought at least 2 product A or at least 1 product C, how to use set analysis, in this case, 1 have bought 2 A and 2 have bought 1 C, so the result is two, how to finish it?
Thanks Miguel Angel Baeyens.
Hello,
Use
Count({< CountMemberId = {"=Count({< Category = {'A'} > + < Category = {'C'} >} CountMemberId) > 1"} >} DISTINCT CountMemberId)
That will return "1" for those CountMemberId who have bought either 2 "A" or 2 "C".
Hope that helps.