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

Conditional multiplication in Qlikview

Dear all,

I have the following situation:

I have a stable table "Overview" with different values for different symptoms.

grafik.png

I now want to calculate an overall score for each patient. the score shall multiply all LR+/LR- scores of all symptoms of each patient. If a patient has a symptom, it shall multiply LR+, otherwise LR-.

Some examples:
Patient A has symptoms 'Hypertension' and 'Obesity' => Score(A) = 1,126*1,333 = 1.5
Patient B has no symptoms => Score(B) = 0,857*0,5 = 0,42
Patient C has symptom 'Obesity', but no 'Hypertension' = > Score(C) = 1,126 * 0,5 = 0,563

The formula I search for, needs to do something like this:

for eachPatient in Patient:
  score(eachPatient) = 1
  for symptom in symptoms:
    if symptom in PatientSymptoms:
      score = score*LR+
   else:
      score = score*LR-

The output table shall look like this:
A;1.5
B;0.42
C;0.563
...

Does somebody know how to do this and could give me advise on it?

Thanks a lot for your help

Philipp

 

10 Replies
daumkep
Contributor II
Contributor II
Author

Hi Shubham,

thanks a lot for your help. It's not exactly what I was looking for (in reality, the number of Symptoms are in the order of hundreds), but it was nevertheless helpful. I guess that I might have to calculate the values outside of Qlik in a script and load it afterwards.

Thanks again
Philipp