Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
andnichols
Contributor II
Contributor II

Multiple conditions for count function

Hi, 

I am having a hard time with the set analysis for the expression below. I am trying to count the patient encounter if the difference between discharge order and discharge time is less than 60 minutes, and the Discharge Year is 2022, and the unit is NOT CICU or NICU. Appreciate any help!

 

(count(if(((HOSP_DISCH_TIME-DISCHARGE_ORDER_TIME)*1440) <=60.01 and [Discharge Unit] =-'CICU' or 'NICU' and year(HOSP_DISCH_TIME)= '2022', PAT_ENC_CSN_ID)))
/

[2022 Total DCs]

Labels (2)
1 Solution

Accepted Solutions
Bunim
Contributor III
Contributor III

Try this -

count({< [Discharge Unit] -={'CICU','NICU'} , HOSP_DISCH_TIME= {'*2022*'}>} if(((HOSP_DISCH_TIME-DISCHARGE_ORDER_TIME)*1440) <=60.01 , PAT_ENC_CSN_ID))
/
[2022 Total DCs]

View solution in original post

2 Replies
Or
MVP
MVP

This formula doesn't contain any set analysis. If you're just trying to fix the if() statement, try replacing the out-of-place syntax with a Match() function:

(count(if(((HOSP_DISCH_TIME-DISCHARGE_ORDER_TIME)*1440) <=60.01 and (Not Match([Discharge Unit],'CICU', 'NICU')) and year(HOSP_DISCH_TIME)= '2022', PAT_ENC_CSN_ID)))
/

[2022 Total DCs]

Bunim
Contributor III
Contributor III

Try this -

count({< [Discharge Unit] -={'CICU','NICU'} , HOSP_DISCH_TIME= {'*2022*'}>} if(((HOSP_DISCH_TIME-DISCHARGE_ORDER_TIME)*1440) <=60.01 , PAT_ENC_CSN_ID))
/
[2022 Total DCs]