Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calendars

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.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thank you all for your valuable inputs, most appreciated.

View solution in original post

13 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

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

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

Thank you.  I want my calendar to load the last three years.  How do i accomplish this?

its_anandrjs

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

its_anandrjs

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());

LastThreeYr.png

Regards,

Anand

markodonovan
Specialist
Specialist

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

its_anandrjs

Thanks Mark, Yes it is right way also.

Regards

Anand

SunilChauhan
Champion
Champion

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

]

;

Sunil Chauhan
its_anandrjs

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