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

Checking variance with variables

Hi all,

I'm new to QW and trying to build an application that will store two chosen years in two different variables that can check the variance between them.

I have set up two different input boxes with the variables vYear1 and vYear2. I have set up a choose in field trigger for the vYear1:

='>=' & vYear1 & '<=' & vYear1, and the same for vYear2: ='>=' & vYear2 & '<=' & vYear2. i've also created two straight lists that are suposed to return Sum($(vYear1)Cost) and Sum($(vYear2)Cost). I also have a variance straight list and i want it to return Sum({<$(vYear2)>} Cost) - Sum({<$(vYear1)>} Cost).

the problem is when i set the value in the input box both the variables in the straight lists gets effected and and i can't select more then one year every time a put in a new value in the input boxes. I cant get the Variance straight list to work either, i think it's because both variables are reading the same year but i don't know how to fix it.

I've attached a sample file with the qwv and the xlsx were i load the data from.

Help, guidance and suggestions will be much appreciated!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try expressions like this: Sum({<Year={$(vYear2)}>} Cost) - Sum({<Year={$(vYear1)}>} Cost)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Try expressions like this: Sum({<Year={$(vYear2)}>} Cost) - Sum({<Year={$(vYear1)}>} Cost)


talk is cheap, supply exceeds demand
Not applicable
Author

still returned 0. think the problem lies in the variable. Both variables sums the same year and subtracts the same value

Gysbert_Wassenaar

Make sure to use both variables. This will always return zero: Sum({<Year={$(vYear1)}>} Cost) - Sum({<Year={$(vYear1)}>} Cost)


talk is cheap, supply exceeds demand
Not applicable
Author

both variables are beeing used. The thing is when i use the input boxes, both variables read from the the box where i made the latest entry. I need the varibles to read from the input boxes separately to make it work.

Gysbert_Wassenaar

I have no idea what you mean. Your example qvw file works fine after fixing the expressions.


talk is cheap, supply exceeds demand
Not applicable
Author

Oh whatch the wrong application:P Thank you!!