Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Multiple Sum if

if(sum(if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge <= 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y',1,0))>=1,'Y', sum(if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge > 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y',1,0))>=1,'L',’N’) 

it doesn't like my above set analysis expression for my qlik chart.. why?

Essentially I want it to mark all my appointments that are less or equal to 2 as a Y (Yes), if they were conducted BUT over 2 days then a L (or late) and if they were not done at all as N (or NO).. can I do this the way I'm writing it?

6 Replies
vishsaggi
Champion III
Champion III

Can you share some sample data with expected output please?

sibin_jacob
Creator III
Creator III

Try this one


if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge <= 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y' ,'Y',

if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge > 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y' ,'L','N'))

Anonymous
Not applicable
Author

this is giving me a No (N) for ones that should be Yes (Y)

Anonymous
Not applicable
Author

Right now I'm doing it in my SQL code instead and writing it like this... rather than within Qlik.

case when sum( case when  ApptConf = 'Y' and DocDayAfterDischarge <= 2 then 1 else 0 end) >= 1 then 'Y'

when sum( case when ApptConf = 'Y' and DocDayAfterDischarge > 2 then 1 else 0 end) >= 1 then 'L'

else 'N' end as ApptConfFinal

vishsaggi
Champion III
Champion III

OK so does this work as expected when you run from SQL?

vamsee
Specialist
Specialist

Maybe try this

IF(

DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y', /** Check for ApptConf **/

IF(

DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge <= 2, /** Appointments <2 days **/

'Y',

IF(

DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge > 2, /** Appointments >2 days **/

'L',

'N'

)

)

)

Thanks.