Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sdepotter
Contributor
Contributor

can't use two variables in an expression

Hi,

Being new to Qlikview I rteally struggle with the following:

I made 2 variables to calculate current headcount and planned headcount

vActualsCurrentMonth==sum({<Calculatemonth={'$(=max(Calculatemonth))'}>} FTE

vProfitPlanCurrentMonth=sum({<Calculatemonth={'$(=max(Calculatemonth))'}>} FTEPP15

Now I want to count the number of divisions where the current headcount (vActualsCurrentMonth) is higher than the planned headcount (vProfitPlanCurrentMonth) and am trying this expression

=Count( {$ <sum({<Calculatemonth={'$(=max(Calculatemonth))'}>} FTE)={">sum({<Calculatemonth={'$(=max(Calculatemonth))'}>} FTEPP15"} DISTINCT Division)

but it is not working. I must be doing something wrong?

Any help is highly appreciated.

4 Replies
sunny_talwar

May be try this:

Sum(Aggr(If(vActualsCurrentMonth > vProfitPlanCurrentMonth, 1, 0), Division))

sdepotter
Contributor
Contributor
Author

Hi,

thansk but it is not fully working. If I make a straight table with the two expressions (not the variables) and I check where the number of actuals is above the planned number, this is 2.

If I use your expression, the count gives a result of 8?

sunny_talwar

Would you be able to share a sample to look at the issue?

sdepotter
Contributor
Contributor
Author

Hi Sunny

tried again. it's working now. thanks a lot for your help!