Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

change label based on selections

Hi

i have a line chart,

this shows how many customers per month

i have 3 measures to achieve the 3 lines

1 - Current Year  (Blue)e.g  CalendarYear  as part of the expression

2 - Year -1 (Green) e.g CalendarYear -1  as part of the expression

3 - Year - 2  (Red) e.g CalendarYear -2 as part of the expression

however there is a filter pane current year, which people can choose

i wish that when app opens  you see on the legend

1 - Current Year  (2016) (Blue)

2 - Year -1 (2015) (Green)

3 - Year - 2 (2014)  (Red)

if you pick from filter pane ...calendar year 2015 the labels on the chart update , thus updating the legend

1 - Current Year  (2015) (Blue)

2 - Year -1 (2014) (Green)

3 - Year - 2 (2013)  (Red)

please help

3 Replies
sunny_talwar

May be something like this:

Current Year -> Only({<Year = {$(=Max(Year))}>} Year)

Year - 1 -> Only({<Year = {$(=Max(Year)-1)}>} Year)

Year - 2 -> Only({<Year = {$(=Max(Year)-2)}>} Year)

joeybird
Creator III
Creator III
Author

hi

i have no issues with the calculations for the years, as expressions.

i have tried to add this to the label, thus  there is is no display expression box in qlik sense

it appears as Only({<Year = {$(=Max(Year))}>} Year)

i need help please on creating a dynamic changing legend, depending on which filter panes are chosen.

please help

Anonymous
Not applicable

Hi

thanks to sunny for the logic , i tried in color back ground

check this

IF(Only({<year = {$(=Max(year))}>} year),blue(),if(Only({<year = {$(=Max(year)-1)}>} year),Green(),Red()))