This content has been marked as final.
Show 4 replies

Re: When is it best to use sum(if()) over Set Analysis in an expression?
Kaushik Solanki Mar 8, 2013 11:43 AM (in response to bridgette )Hi,
Kindly go though the attached file for clarification on each of the expression.
Regards,
Kaushik Solanki

Re: When is it best to use sum(if()) over Set Analysis in an expression?
Henric Cronström Mar 8, 2013 3:37 PM (in response to bridgette )Often the Set analysis is faster than the Sum(If(...)). However, to make a fair comparison you must compare five different cases:
 Sum(if(IsThisYear='True' , Sales))
The string comparison "IsThisYear='True'" is CPUexpensive. Avoid this construction!  Sum(if(Year=2013 , Sales))
A numeric comparison is a lot faster than a string comparison. But still slower than a booloean.  Sum(IsThisYear * Sales)
A multiplication works fine if the aggregation is a Sum. It does not work with Avg or Count. And multiplication is not very fast.  Sum(if(IsThisYear , Sales))
Using the "IsThisYear" as a boolean is faster than using it in a relational comparison.  Sum({$<IsThisYear={1}>} Sales)
Set analysis is often the fastest way.
My view is that alternative 4 or 5 are acceptably fast, but the three first constructions should be avoided.
HIC
 Sum(if(IsThisYear='True' , Sales))

Re: When is it best to use sum(if()) over Set Analysis in an expression?
Shankar Kalyanam Mar 8, 2013 4:34 PM (in response to bridgette )Yes set analysis is the fastest way.

Re: When is it best to use sum(if()) over Set Analysis in an expression?
Kuldeep Choudhary May 18, 2015 10:37 AM (in response to bridgette )Thanks
This was really very helpful for me!
Regards,
Kuldeep