4 Replies Latest reply: Apr 18, 2011 1:53 PM by sirguise

# Set Analysis with "OR"

Simple problem, hopefully simple solution.

I have a sales table, each sale has two salespeople. Using set analysis the equation for one salesperson is something like

sum({< Salesperson1 = {"\$(=getfieldselections(SalesPerson))"} SalesAmount)

That part works fine. However I'd like to do something like

sum({< Salesperson1 = {"\$(=getfieldselections(SalesPerson))"} OR Salesperson2 = {"\$(=getfieldselections(SalesPerson))"} SalesAmount)

Any suggestions on the syntax to make the "OR" work?

Thanks, Dave.

• ###### Re. :Set Analysis with "OR"

You can try this :

sum({< Salesperson1 = {"\$(=getfieldselections(SalesPerson))"}>} SalesAmount) + sum({< Salesperson2 = {"\$(=getfieldselections(SalesPerson))"}>} SalesAmount)

Regards,

Vincent

• ###### Re. :Set Analysis with "OR"

Hi Vincent -

Thanks for the quick reply, however what happens with your solution is that you are actually doubling the result in the event both Salesperson1 and Salesperson2 are the same person. You effectively are creating an "And" statement, not using the exclusion benefits of an "Or" statement.

Thanks, Dave

• ###### Set Analysis with "OR"

You can create a union the the sets

sum({< Salesperson1 = {"\$(=getfieldselections(SalesPerson))"} >+< Salesperson2 = {"\$(=getfieldselections(SalesPerson))"} >} SalesAmount)

This way you will not count a sale twice (if salesperson1 and 2 are in SalesPerson)

You can also try to use p() function:

sum({< Salesperson1 =p(SalesPerson) >+< Salesperson2 =p(SalesPerson) >} SalesAmount)

• ###### Set Analysis with "OR"

Thanks Erick, I just happened to stumble into the answer as well. This is the perfect result.

Dave