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

Strange set analysis results!!!

Dear Experts,

I am using following syntax to get the number of patients who had a lab test (ID 1526664),

count(distinct {$<PAT_ID={'=COMPONENT_ID=1526664'}>}PAT_ID)

It returns only 1 even though there are 8 unique PAT_IDs. However, when 1526664 in the listbox is selected, this syntax returned correct number (8) of distinct PAT_ID. I cannot understand this. Please advice.

Sample project is attached for your reference.

Thanks in advance.

Longmatch.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

This might be what you are looking for:

2017-01-06 00_23_26-Text Object Properties [1526664 Patient number_   1].png

View solution in original post

9 Replies
petter
Partner - Champion III
Partner - Champion III

This might be what you are looking for:

2017-01-06 00_23_26-Text Object Properties [1526664 Patient number_   1].png

baylor2016
Creator
Creator
Author

Dear Petter,

Thank you for your helps. I am trying to use Nicole Smith's method for this kind of work. Please refer her reply to my previous post - Nested aggregation helps. I just want to see know why it does not work here.

Thanks

Longmatch

petter
Partner - Champion III
Partner - Champion III

OK - so do you still want anyone to answer your question or did my suggestion answer it? If not please let us know.

Anil_Babu_Samineni

What is your Intend. And Above Provides expression seems work. What was you are expecting into?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
baylor2016
Creator
Creator
Author

Thank you - Petter and Anil,

Petter provided works but actually my question is what is the problem in my expression and the strange behavior in my sample project. I am planning to use this logic in my project for intersection set analysis.

sunny_talwar

May be you want to do this:

='1526664 Patient number:  ' & count(distinct {$<PAT_ID={"=WildMatch(Concat(DISTINCT COMPONENT_ID, ', '), '*1526664*')"}>}PAT_ID)

PAT_ID is made up of several COMPONENT_ID, so in order to check if one of them is 1526664, you need to either use WildMatch, Index or SubStringCount function with Concat() on COMPONENT_ID to make this work

Nicole-Smith

petter-s‌ gave the correct answer of:

count( {$<COMPONENT_ID={1526664}>} distinct PAT_ID)

You should go with this because it is the simplest approach.

Your last post needed aggregations within the set analysis, which is why it was more complicated.

baylor2016
Creator
Creator
Author

Sunny, Thank you for your helps. Your solution works well. I wish I can also make yours as correct answer.

sunny_talwar

Hahahaha no problem my friend. My solution was just to explain why your attempt did not work, but I would go with what petter-s‌ gave because that is the way to do this .

Best,

Sunny