Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have a requirement that,
in table i have a year field with 2011,2012,2013,2014
now using a variable i need grab the last two values even if another value is added to it
i.e, if we add 2015
i need to get 2014 and 2015
if we add another one 2016
i need to get 2015 and 2016
last two values i have to get.
Hi laxman,
If you need two variables to do it or if you want to make ranges:
vMaxYear = Max(Year)
vMinYear = Max({<Year = {"<$(vMaxYear)"}>}Year)
If you want it on same var to make selections with actions:
vMaxYear = Max(Year)
vYears = '('&Max(Year)&'|'&Max({<Year = {"<$(vMaxYear)"}>}Year)&')'
Regards
Let vMaxY1 = max(Year) ;
Let vMaxY2 = (vMaxY1 - 1) ;
Hi,
Colin's answer should get them for you, But there are a few different ways you can do this.
If you could supply us some more information on what your are wanting to do with these years we could suggest the best approach.
i.e. Just display in a test box or feed into set analysis.
Mark
Hi Colin,
What happen if there isn't two consecutive years?
i tried but it showing
in valid dimesion
hi mark
i want to display it in a textbox
Hi ,
Colin's answer is precise but if you want the last two years for table having more than 1 distinct year , then use an additional 'if' statement for checking the count in the expression which Manuel has provided .
Hi,
One way would be
=' Selected - ' & MAX(GetFieldSelections(Year)) & '- Previous - ' & MAX(GetFieldSelections(Year )-1)
Mark
Could you share an example app?