Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have this expression in a straight table:
Sum({$<Year={$(=Only(Year)-1)}>} Sales)
I cannot get this syntax (the underline one)
Thanks in advance
$(=Only(Year)-1) is a dollar sign expansion, so it will evaluate the expression contained and it will be replaced with the result before the sum(... Sales) is evaluated.
Only(Year) will return the possible value from field Year, but only if there is only one possible value (i.e. you have actively selected one year or limited to one possible by selecting on other fields). You could also use max(Year) to always get a value returned, though results are different to only(year) if there are multiple possible values.
Then you deduct 1 from the Year value, giving the year number prior the possible value.
So if today's year 2011 is the only possible value, it will expand to
Sum({$<Year={2010}>} Sales)
Hope this helps,
Stefan
if variable Yaer = 2011 is the sum of sales for year 2010
$(=Only(Year)-1) is a dollar sign expansion, so it will evaluate the expression contained and it will be replaced with the result before the sum(... Sales) is evaluated.
Only(Year) will return the possible value from field Year, but only if there is only one possible value (i.e. you have actively selected one year or limited to one possible by selecting on other fields). You could also use max(Year) to always get a value returned, though results are different to only(year) if there are multiple possible values.
Then you deduct 1 from the Year value, giving the year number prior the possible value.
So if today's year 2011 is the only possible value, it will expand to
Sum({$<Year={2010}>} Sales)
Hope this helps,
Stefan