Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
krmvacar
Creator II
Creator II

variable in Sum

Hi All,

I have a variable and I have 2 total values in this variable.

the content of my variable Test2; sum(grosstotal) + sum (grossamount)

My expression =  Sum({<PERNUM = {"=Sum([$(vTest2)]) > 0"}>} $(vTest2)) but is not working.

What I want to do here is to bring the data of the personnel except the zero sum.

how can i use the variable here please help

Labels (2)
10 Replies
JordyWegman
Partner - Master
Partner - Master

Hi,

Do you want to exclude personnel that has 0 gross sales?

Jordy

Climber

Work smarter, not harder
Digvijay_Singh

Its very difficult to be 100% sure what is happening behind the error without knowing where the expression is used, the chart involved etc.

I think once the variable expression is expanded it would be like Sum(Sum()) and that is not permitted. You would need to use Aggr before the final sum, I am not able to understand the expression logic, do you want to actually count PERNUM having Test2 values >0 or  do you want to avoid personnel with negative values in the final aggregation?

krmvacar
Creator II
Creator II
Author

Yes

krmvacar
Creator II
Creator II
Author

I want to display at least three people here. I put it inside the variable because I used two totals, but the variable didn't work

JordyWegman
Partner - Master
Partner - Master

Since it's only excluding the zero values, why don't you use this:

Sum({< GrossAmount -= {0} , GrossTotal -= {0} >} GrossTotal + GrossAmount )

Jordy

Climber

Work smarter, not harder
Digvijay_Singh

If you want to COUNT PERNUM, it might be something like this but it might need some formatting around the $ expansion

Count({<PERNUM = {"=Sum(Aggr($(vTest2),PERNUM)) > 0"}>} PERNUM)

If you can share some sample data, hopefully someone would give you the perfect expression.

krmvacar
Creator II
Creator II
Author

thanks for the answer but can't I use it with a variable? 

Sum({< $(vTest2) -= {0} >} $(vTest2) )

 

Can you change it for me variables?

krmvacar
Creator II
Creator II
Author

ok ı will send  my qvf.

 

What I want to do here is to display only 3 people with the least income. I have addition operations in variable

 

Thank you very much for your help.

Digvijay_Singh

Vow!! your expression is super complex, I couldn't much understand the nitty gritty of it, but pl check if something I did in the attached sample can give you some direction, its not done yet but may throw some ideas for you -