Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
yreboredo
Contributor II
Contributor II

Conditional Count

Hello,

We need to create a measure to get the distinct count of patients when any of the fields listed below are equal to 'Yes'. The expression below is counting patients regardless of the field value.

Count(

{<[10467]={'Yes'}>

//or

+<[20229]={'Yes'}>

//or

+<[23385]={'Yes'}>

//or

+<[22927]={'Yes'}>

//or

+<[20940]={'Yes'}>

//or

+<[23209]={'Yes'}>

//or

+<[23495]={'Yes'}>

//or

+<[23555]={'Yes'}>

//or

+<[23576]={'Yes'}>} Distinct PAT_ID)

Any help will be appreciated.

Thanks

1 Solution

Accepted Solutions
sunny_talwar

How about this

Count(DISTINCT {<PAT_ID = {"=SubStringCount('|'&[10467]&'|'&[20229]&'|'&[23385]&'|'&[22927]&'|'&[20940]&'|'&[23209]&'|'&[23495]&'|'&[23555]&'|'&[23576]&'|', '|Yes|') > 0"}>} PAT_ID)

View solution in original post

4 Replies
Lisa_P
Employee
Employee

Just use ',' as a separator for each field in Set Analysis. 

Count( {<[10467]={'Yes'}, [20229]={'Yes'}, [23385]={'Yes'}, [22927]={'Yes'}, [20940]={'Yes'}, [23209]={'Yes'}, [23495]={'Yes'}[23555]={'Yes'}, [23576]={'Yes'}>} Distinct PAT_ID)

sunny_talwar

How about this

Count(DISTINCT {<PAT_ID = {"=SubStringCount('|'&[10467]&'|'&[20229]&'|'&[23385]&'|'&[22927]&'|'&[20940]&'|'&[23209]&'|'&[23495]&'|'&[23555]&'|'&[23576]&'|', '|Yes|') > 0"}>} PAT_ID)

yreboredo
Contributor II
Contributor II
Author

It worked...Thank you!

yreboredo
Contributor II
Contributor II
Author

Hi Lisa,

Your suggestion will work if all the fields meet the condition (and), in our case we need any of the fields (or).

Thank you for looking into it!