2 Replies Latest reply: Jul 8, 2015 5:46 AM by Moctar Ba

# Select all previous months in a Calendar

Hi, I have a graph linked to a calendar: when I select a Month, the graph displays the information related to this month. Is there a way to show all the data of the previous months in the same year (as if I had selected at once all the previous months in the calendar) by selecting only ONE month.

I would appreciate it if there was an easy way to switch between the two type of calendars (one which displays only current month and another which displays all previous months).

Thanks.

• ###### Re: Select all previous months in a Calendar

you can use set analysis, something like (Month is the calendar month field, Date the calendar date field)

this is the sum of v from the start of the year (YearStart) to the end of previous month (MonthStart -1 day)

Sum({\$<Month=,Date={">=\$(=(YearStart(max(Date))))<=\$(=date(MonthStart(max(Date))-1))"}>} [v])

to switch

you can use a button and 2 expression (conditional), one for one month one for the months

or you can group the expressions

• ###### Re: Select all previous months in a Calendar

Thank you for your help but it doesn't work: this formula gives me the sum of all the data since the start of the calendar (1987) regardless of the selected date on the calendar. What I want is the sum of all the data of the selected year from the first month to the selected month (if I select May 2014 I want all the data from the first of January to May 2015).

EDIT: I solved the problem I modified your expression to this:

SUM({<Year = {\$(=Year)}, Month = {"<=\$(=num(Month))"}>} variable)

and it worked.