
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Tags:
- qlikview_scripting


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you share some sample data with expected output please?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this one
if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge <= 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y' ,'Y',
if(DHVNHFProtocolCareStepPerfMeasures.DocDayAfterDischarge > 2 and DHVNHFProtocolCareStepPerfMeasures.ApptConf = 'Y' ,'L','N'))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this is giving me a No (N) for ones that should be Yes (Y)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK so does this work as expected when you run from SQL?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
