Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to turn the Count (Distinct expression into a set?
I really hate the performance drainer that count distinct is.
Here is an expression:
Count (Distinct if(Counter='1'and Shop <> '1101' and _YTD_WTY='1',Kvitto))
I'm thinking:
Count ( {< Counter = {'1'}, Shop -= {'1101'} >} Kvitto*_YTD_WTY)
The thing is that when I use the set expression (which works btw) my data changes. I use the formula to calculate number of transactions (Kvitto translates into Receipt in Swedish). So the whole expression is then later divided by visitors.
I can see the changes are small but nonetheless there. Some results change from 2.3% to 2.4% and similar.
Where am I going wrong with this?
Are you may be missing a DISTINCT?
Count(DISTINCT {< Counter = {'1'}, Shop -= {'1101'}>} Kvitto*_YTD_WTY)
This this way?
Count ( {< Counter = {'1'}, Shop -= {'1101'}, _YTD_WTY={1} >} Kvitto)
Are you may be missing a DISTINCT?
Count(DISTINCT {< Counter = {'1'}, Shop -= {'1101'}>} Kvitto*_YTD_WTY)
Yeah, this works!
So just a follow-up question; how would the two expressions compare performance-wise? Isn't Count(DISTINCT quite heavy to calculate ? Albeit the removed If-expression should do its part.
It is a myth as suggested by HIC
Exactly what I needed thanks Sunny.