Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare Charts Using a Slider

Hi,

I have a requirement to create a page that contains two charts and give users the ability to use one or more sliders to select months and compare them against each other.

For example, I will like to show in one chart selections for Jun-11 and in the second chart selections for Jan-11 by adjusting the sliders only, so that people can look at both charts at the same time and make a quick comparison between months on the fly. I tried doing something with a slider, but each time I adjusted the slider it affected both charts and not just one chart.

Is there a way to do something clever with say two sliders to get this to work?

Thanks

1 Solution

Accepted Solutions
sbaldwin
Partner - Creator III
Partner - Creator III

Hi there are a couple of ways you can do this, the first is using 2 variables using an input box to set the variables, then have an expression in each chart that looks like this

sum({<Period = {$(v_month2)}>} Sales)

or you could have 2 data islands you could then use a slider to select from each and have expressions in your charts that look like this

:sum({<Period = {$(=only(Period2))}>} Sales)

I have attached an example that uses these tweo methods, hope this helps

Thanks

Steve

View solution in original post

4 Replies
sbaldwin
Partner - Creator III
Partner - Creator III

Hi there are a couple of ways you can do this, the first is using 2 variables using an input box to set the variables, then have an expression in each chart that looks like this

sum({<Period = {$(v_month2)}>} Sales)

or you could have 2 data islands you could then use a slider to select from each and have expressions in your charts that look like this

:sum({<Period = {$(=only(Period2))}>} Sales)

I have attached an example that uses these tweo methods, hope this helps

Thanks

Steve

Not applicable
Author

Thanks a lot Baldwin.

Both solutions do the trick.

Just out of curiousity, is there a way I can do the slider bit without creating the date island?

Thanks for your help once again

sbaldwin
Partner - Creator III
Partner - Creator III

Hi, well not neatly.. however you could pick the start number as 201101 and the end number as 201112 with an increment of 1 for both sliders and attach each of the variables to the sliders. of course this doesn't work if you want to jump to the next year as as far as the slider is conserned the difference between 201112 and 101201 is 89 as the slider just views it as an interger... you could have a second slider for each of these sliders that would pick the year and the start and end values of the sliders as a function of the variables attached to the secondary variables. so if the variable was v_pickyear with a start and end of 2009 and 2010 you could set the start and end of your month selecters with the functions

=v_pickyear &'01'

=v_pickyear &'12'

but this is getting a bit messy i would probably stick to the data islands.

Thanks

Steve

Not applicable
Author

Cheers mate.

Very useful info. I will stick to your original solution. It works like a charm