Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Within a calendar, can you limit the years to be displayed in your application. Lets say you have data covering the following years:
2009
2010
2011
2012
2013
2014
Can i restrict my calendar to say the last three years or something like that? Thank you in advance.
Thank you all for your valuable inputs, most appreciated.
Hi
You might get better help if you were more specific. Do you want to load only the last three years? Or display the last three years in a chart or table? Do you want a calculated dimension, or a set expression?
For example, you could use this in a set expressiom:
{<Year = {'>=$(=Max(Year) - 3)'}>}
HTH
Jonathan
Thank you. I want my calendar to load the last three years. How do i accomplish this?
Hi,
In the load script you can achieve this by
Data:
LOAD * Inline
[
Year
2009
2010
2011
2012
2013
2014
]
Where Year >= Year( Today() ) - 2 AND Year <= Year( Today() );
Regards,
Anand
Hi,
For better explain i load another table with only last latest years
Data:
LOAD * Inline
[
Year
2009
2010
2011
2012
2013
2014 ];
Filtered:
LOAD
Year as Last3Year
Resident Data Where Year >= Year(Today())-2 and Year <= Year(Today());
Regards,
Anand
Hi Anand,
Excellent example.
I guess you could also keep the Where clause even simpler if you didn't have any years in the future such as 2015.
Filtered:
LOAD
Year as Last3Year
Resident Data
Where Year >= Year(Today())-2;
Thanks
Mark
www.techstuffy.com
Thanks Mark, Yes it is right way also.
Regards
Anand
below condition is worth to write
AND Year <= Year( Today()
only
Where Year >= Year( Today() ) - 2 condition will do the trick
see example below
Load Year
if( Year >= Year( Today() ) - 2,Year ) as Last3years;
LOAD * Inline
[
Year
2009
2010
2011
2012
2013
2014
]
;
There is another approach for the same as Sunil suggest by using Flag field if you want to keep both the fields and also do not need to create another table.
Ex:-
Load
Year,
if( Year >= Year(Today())-2, 1, 0) as Last3YrFlag;
LOAD * Inline
[ Year
2009
2010
2011
2012
2013
2014 ];
But in the expression you have to write SET expression
Sum( {<Last3YrFlag ={'1'} >} Metrics )
Regards
Anand