Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
baylor2016
Creator
Creator

How to union these two set analysis?

Hi,

I need to get the number of patients who either did the test (1557742)  by using

= count(DISTINCT{

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

COMPONENT_ID= {1557742},

LABORDERDATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"}

>

}PAT_ID)

or is a NEPHROPATHY patient by using

=count(DISTINCT{

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

FLAG_NEPHROPATHY= {1},

NEPHROPATHYDATE={"$(='>=' & Date(V_selectedDate_1YearAgo))"}

>

}PAT_ID)

The first returns 250 and the second returns 97. I cannot add them up since some patients did this test and is also a NEPHROPATHY patient. How to get the number of unique patients meeting these two criteria is my question.

I tried to union these two sets below, but I got 40. Not sure what I did wrong.

= count(DISTINCT{

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

COMPONENT_ID= {1557742},

LABORDERDATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"}

>

+

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

FLAG_NEPHROPATHY= {1},

NEPHROPATHYDATE={"$(='>=' & Date(V_selectedDate_1YearAgo))"}

>

}PAT_ID)

Thanks

5 Replies
Anil_Babu_Samineni

+ indicator OR operation. Try Expression1 + Expression2

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

I used '+' operator, but it returns 40.

baylor2016
Creator
Creator
Author

I cannot add two expressions together since some patients did test and is NEPHROPATHY patient. The total patient number meet either of these two criteria should be between 250 and 347.

Anil_Babu_Samineni

I mean this?

= count(DISTINCT{

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

COMPONENT_ID= {1557742},

LABORDERDATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"}

>

}PAT_ID)

+

count(DISTINCT{

<

YearMonth,

FLAG_DM={1},

CONTACT_DATE2 = {"$(='>=' & Date(V_selectedDate_1YearAgo) & '<=' & Date(V_selectedDate))"},

PAT_ID = {"=Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) >= 18 and

            Age(Num(V_selectedDate), Only({<YearMonth>}BIRTH_DATE)) <= 75"},

FLAG_NEPHROPATHY= {1},

NEPHROPATHYDATE={"$(='>=' & Date(V_selectedDate_1YearAgo))"}

>

}PAT_ID)

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
jmvilaplanap
Specialist
Specialist

Hi,

You must to insert the '+' symbol inside the Set Analysis

Ex:

  • count({<EXP1> + <EXP2>} Distinct PAT_ID)

Regards