Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
cohenj3_
New Contributor III

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
Contributor III

Re: Assign sum to a varaiable

Hi

try like this

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

3 Replies

Re: Assign sum to a varaiable

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?

cohenj3_
New Contributor III

Re: Assign sum to a varaiable

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
Contributor III

Re: Assign sum to a varaiable

Hi

try like this

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

Community Browser