Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

2 Replies
maxgro
MVP
MVP

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))"}>} )

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

Not applicable
Author

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.