Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to show two different totals based on the year that the user selects (selected year and previous year). So if the user selects '2009' as the Year, then I want to show totals for both 2009 and 2008. Please advise.
Thanks,
Kevin
If the user selects one year, then this expression will give you that year:
=ONLY(YearField)
Then you can use Set Analysis and a dollar sign expansion:
Sum({<YearField={$(=ONLY(YearField))}>} Sales)
For the previous year, use:
Sum({<YearField={$(=ONLY(YearField)-1)}>} Sales)
To combine them:
Sum({<YearField={$(=ONLY(YearField)), $(=ONLY(YearField)-1)}>} Sales)
I haven't tested that last one, but it seems like it should work.
Can you draw a table of what you want to do or post an example
Nimish
Use NMiller's first expression <blockquote><pre> Sum({<YearField={$(=ONLY(YearField))}>} Sales)for an expression and
for another. You can easily more for showing even more previous year. Just replace '-1' with '-2', '-3', etc.Sum({<YearField={$(=ONLY(YearField)-1)}>} Sales)