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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis and Dates

Hi,

I think this is a fairly simple question, but I'm new to QV so any help would be greatly appreciated.

The problem:

We are looking at patient data in a hospital. What we want to look at is how many of patients are receiving greater than 500 calories at their first outpatient followup from the hopsital. As such, I want to count the following:

IF Outpatient_Date is at a minimum (i.e., their first outpatient followup)

Then Count IF Caloric_Intake > 500.

We only want to be counting the caloric intake at the very first outpatient followup visit, and only want to count that caloric intake IF greater than 500 cals.

I am able to get here:

=COUNT(DISTINCT {$<[OUTPT_CALDENS] = {">=500"}>} PAT_ID)

But have no clue how to incorporate the second (and most important) parameter: that the Outpatient_Date is at a minimum.

Thank you SO much.

P.S. A second challenge:

Rather than simply counting the first outpatient follow-up, is there a way to count the MOST RECENT date from the hospital discharge date? i.e. If patient is discharged on 1-1-13 and had 20 followups, can we code into qlikview a way to match the nearest date to the hospital discharge date?

3 Replies
sushil353
Master II
Master II

try this:

=COUNT(DISTINCT {1<[Outpatient_Date]={$(=Min([Outpatient_Date]))},[OUTPT_CALDENS] = {">=500"}>} PAT_ID)

If that dont work then post some sample data.

HTh

Sushil

Not applicable
Author

Thanks Sushil for taking a stab at it...

so it doesn't seem to like it. I changed the field names to reflect mine and doesn't work.

here's some data:

PAT_MRN_ID     DATE_OUTPT     OUTPT_CALDENS

1                      jan 1                          300

1                      jan 7                          500

1                      jan-27                        700

2                      march 17                   650

2                      march 29                   400

2                      april 5                        325

2                      april 7                        800

3                      jan 10                        900

3                      jan 14                       1000

the correct count the above situation should be 2. There are two patients (ID 2 and 3 who receive >500 calories in their FIRST outpatient visit.

thank you SO much.

msteedle
Partner - Creator
Partner - Creator

There is a way to do this on the front end, but the values you request are knowable at the time of reload and will not change based on user selections. As such, it should probably be built into the data model.