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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Assign sum to a varaiable

Hi,

What is wrong with the following:

Let vDrugs = Sum(if(Medication_Drug1>0,Medication_Drug1,0)) + Sum(if(Medication_Drug2>0,Medication_Drug2,0))

1 Solution

Accepted Solutions
syukyo_zhu
Creator III
Creator III

Hi

try like this

Let vDrugs = 'Sum(if(Medication_Drug1>0,Medication_Drug1,0)) + Sum(if(Medication_Drug2>0,Medication_Drug2,0))';

View solution in original post

3 Replies
sunny_talwar

Are you using this in the script or the intention is to use this on the front end? And what kind of error are you getting?

Anonymous
Not applicable
Author

The error – “error in script” (when I reload.

The intent is to sum the two columns (numeric/integer), and add them to create vDrugs. Then, present the value of vDrugs on one of the sheets.

syukyo_zhu
Creator III
Creator III

Hi

try like this

Let vDrugs = 'Sum(if(Medication_Drug1>0,Medication_Drug1,0)) + Sum(if(Medication_Drug2>0,Medication_Drug2,0))';