Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am trying to generate a dynamic set analysis string based upon users' selections. The two list boxes in fact are the same data with different field names, and one is in NOT state. Is this ok to do it? I know data in Qlik are linked. A set analysis string for default state (it might not be necessary) and Not state are generated respectively and merged in one used in default state.
It looks like the generated set analysis string is correct, but the numbers returned is wrong. I am expecting the following expression returns 3, but it return 4 meaning the E() function is not working. Please advise. Thanks
=count(distinct {(<PatientID=p({<[Disease]={'Diabetes'}>} PatientID)>)*(<PatientID=E({<[Disease]={'CVD'}>} PatientID)>)} PatientID)
Sample project is attached.
Longmatch
May be like this
=Count(distinct
{<PatientID = p({<Disease = p(Disease)>})
-
p({NOT<[Disease]={'Cancer', 'COPD'}>} PatientID)>}
PatientID)
and to make the second part dynamic, may be this
=Count(DISTINCT {<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p(Disease)>} PatientID)>} PatientID)
=Count(DISTINCT {<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p({NOT}Disease)>} PatientID)>} PatientID)
May be this
=Count(DISTINCT {<PatientID=p({<[Disease]={'Diabetes'}>} PatientID)-p({NOT<[Disease]={'CVD'}>} PatientID)>} PatientID)
Thank you for your help. It works fine.
If multiple conditions are selected in both list boxes (one in inherited state and the other in NOT state), I thought the following expression should work, but it doesn't. What I did wrong?
Thanks
=Count(distinct
{
<
PatientID=
p({
<[Disease]={'Diabetes'}>+
<[Disease]={'Depression'}>+
<[Disease]={'CHF'}>
} PatientID)
-
p({NOT
<[Disease]={'Cancer'}>+
NOT<[Disease]={'COPD'}>
} PatientID)
>
}
PatientID)
I believe this should work
=Count(distinct
{<PatientID=
p({<[Disease]={'Diabetes', 'Depression', 'CHF'}>} PatientID)
-
p({NOT<[Disease]={'Cancer', 'COPD'}>} PatientID)>}
PatientID)
Logically this one is simpler. I will change the dynamic part to make it work. Thanks!!!
Do I need explicitly create set analysis string for Inherited state? I tried to use
=Count(distinct
{<PatientID=
$
-
p({NOT<[Disease]={'Cancer', 'COPD'}>} PatientID)>}
PatientID)
It returns zero.
Thanks.
With selection or without selections?
With selection.
May be like this
=Count(distinct
{<PatientID = p({<Disease = p(Disease)>})
-
p({NOT<[Disease]={'Cancer', 'COPD'}>} PatientID)>}
PatientID)
and to make the second part dynamic, may be this
=Count(DISTINCT {<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p(Disease)>} PatientID)>} PatientID)
=Count(DISTINCT {<PatientID = p({<Disease = p(Disease)>})-p({NOT<[Disease]=p({NOT}Disease)>} PatientID)>} PatientID)
I will try it and let you know the results. Thanks
Attaching an image and a sample