Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For example,
when selection: Year_C(2009,2010) --- one or more value is selected,
Month_C(1,2,3,4,5,6,7,8,9,10,11,12) --- one or more value is selected
Year_V(2009,2010) --- one or more value is selected,
Month_V(1,2,3,4,5,6,7,8,9,10,11,12) --- one or more value is selected
then the Set Analysis expression is:
sum({<Year=Year_C,Month=Month_C>} sales) - sum({<Year=Year_V,Month=Month_V>} sales)
but if when Month_C and Month_V is none selected,
then I want the expression will be:
sum({<Year=Year_C>} sales) - sum({<Year=Year_V>} sales) (Month is excluded)
How to write a simply expression to achieve it?
You could do the following:
=if(GetSelectedCount(Month_C)=0 or GetSelectedCount(Month_V)=0,
'sum basado en año',
'sum basado en año y mes'
)
Regards.
Can I use IF in Set Analysis?
No, you cannot put an if in set analysis.
The syntax would be:
if( condition, sum({$<...>} amount), sum({$<...>} amount))
In many cases, your's included, it might be easier to do a sum( if(year=year_c, amount,0) instead of sum({$<year=year_c>} amount) because I don't think set analysis is going to work when you have more than one year_c selected.
Regards.
Hi Karl,
I have similar expression, but what i'm trying to do is, to exclude zone ,
i can easily do it in SET, but how do i do it with the IF?
any idea?
if( condition, sum({$<zone=>} amount), sum({$<zone=>} amount))
THanks.