Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Buttons

Hello, I have a questions about buttons.

If i have a chart that shows:

Brand     2013$     2014$      Variance       %Change     2013 Units     2014 Units     Variance     %Change

can i create a button that can switch all fields in that chart to show 2014 vs 2015 (just like above with different dates?) if so, what is the best way to do that?

thanks for the help,

Parrish

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Simple example attached

View solution in original post

9 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Define a variable (with value 0 and 1) then with the button switch between 0 and 1.

In the column 2014 you can then write:

If(myVar=0, Sum(... values 2014). Sum(... values 2014))

Let me know

maleksafa
Specialist
Specialist

you mean you want to hide buttons when you click on a button?

if this is the case, then you need to create a variable call it vShow, when you click on the button for the first time you will evaluate the variable if (vshow=0,1,0), so you will set it to 1 if it is 0 or 0 if it is 1.

now in your chart, go to the expressions that you want to show/hide, and under conditional add the variable vShow. and this will do the trick

Not applicable
Author

no, i want the entire chart to change from a 2013 vs 2014 comparison to a 2014 vs 2015 comparison - since some of the fields will be identical between the two comparisons i am a little stuck.

Anonymous
Not applicable
Author

I think a better idea is to have a list box with all possible years, where you can select a year, and the chart will be a little more dynamic.  That is, if you select 2015, the chart is 2014 - 2015, and if you select 2014, it is 2013 - 2014.  Easy to implement with set analysis.

sebastianlettner
Partner - Creator
Partner - Creator

Hi,

you could use a input box and set analysis.

vBaseYear=Value from Input Box

sum({$ <Year={$(vBaseYear)}>} Value) and sum({$ <Year={$(vBaseYear) - 1}>} Value)

Anonymous
Not applicable
Author

Simple example attached

awhitfield
Partner - Champion
Partner - Champion

Hi Parrish,

If you want to did it that way,create 2 copies of the chart, one for each set of dates, create a variable, point a button at the variable to set the value to 1 or 0, then add a conditional show to each table, then you can toggle between them.

I Have attached a basic example.

Regards,

Andy

Not applicable
Author

Michael, this was very helpful for the date part, however is there another simple formula to use for units?

Not applicable
Author

just kidding! please disregard. this worked perfectly!! thanks so much for your help!