Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF / AGGR / OR function into Set Analysis

Hi,

Can someone please help me out to change the below function using set analysis.

SUM(AGGR((IF(A='1' OR B='1' OR C='1',SALES)), OP, PER)) /
SUM(AGGR((IF(A='1' OR B='1' OR C='1',VOLUME)), OP, PER)))

Thanks

5 Replies
Not applicable
Author

If anyone has some suggestions, please let me know.

johnw
Champion III
Champion III

Maybe this, but I'm not very confident in it without some data to play with:

sum(aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} SALES ),OP,PER))
/sum(aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} VOLUME),OP,PER))

It might even require something like this:

sum({<A={'1'}>+<B={'1'}>+<C={'1'}>} aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} SALES ),OP,PER))
/sum({<A={'1'}>+<B={'1'}>+<C={'1'}>} aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} VOLUME),OP,PER))

Not applicable
Author

Thanks John. You code was excellent and made our day.

I was looking at the forum for long time and didn't find any solution with aggr / or combination.

Thanks.for your time and appreciate your help.

johnw
Champion III
Champion III

Out of curiousity and to help others who may happen upon this thread, which version of the code worked, or did it take some further modification?

Not applicable
Author

Your first expression worked as expected.

sum(aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} SALES ),OP,PER))
/sum(aggr(only({<A={'1'}>+<B={'1'}>+<C={'1'}>} VOLUME),OP,PER))

Thanks.