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

Maintain variable formula when value manually entered.

I have a problem where I am calculating rankings / bandings.  These are based on 2 different weightings:

Sales Weight & Growth Weight  (vSales & vGrowth)

I have 2 sliders representing these 2 variables.

Both variables summed together should always be equal to 100% (or 1).

Now if I set the vSales = 1-vGrowth and vGrowth = 1-vSales then it essentially works but as soon as you move one the sliders then the underlying variable gets reset to the actual value you selected on the slider. (The other slider will move by itself until you actually set that maually in which case it will also replace the underlying formula)

There must be an elegent way to achieve this ?  Perhaps by using a 3rd subsitiute variable ?

1 Solution

Accepted Solutions
Not applicable
Author

OK I figured it out.

Set up a trigger for the OnChange event when the variable changes.  On that trigger pick the set variable option and set the other related variable to be equal to 1-this variable

IE:  On change of vSales set vGrowth = 1-vSales

     On change of vGrowth set vSales = 1-vGrowth

and there we have it - sliders that move in relation to each other !

Only problem is now I need to figure out if this will work in Ajax client and any other environments.

View solution in original post

3 Replies
Not applicable
Author

Just a note here - it does not have to move the sliders automatically - it can also constain the values toa maximum based on the other value.

Not applicable
Author

OK I figured it out.

Set up a trigger for the OnChange event when the variable changes.  On that trigger pick the set variable option and set the other related variable to be equal to 1-this variable

IE:  On change of vSales set vGrowth = 1-vSales

     On change of vGrowth set vSales = 1-vGrowth

and there we have it - sliders that move in relation to each other !

Only problem is now I need to figure out if this will work in Ajax client and any other environments.

Not applicable
Author

Now the question is:

How to do the same thing with 3 variables ?