Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm sure this question might have already been answered but I can't seem to find exactly what I'm looking for.
I just want to create 2 straight tables that will give me figures for 'Number of Admissions per Specialty' and 'Number of Discharges per Specialty' for a specific date range.
I want to use the same date filter however but number of admissions will be based on the AdmitDate and number of discharges will be based on DischargeDate.
Not sure how to go about this. Any help is appreciated.
Thanks
Ciara
Hi - I think you need to fix the synthetic key by adding master calendar to your data. I think you will not need set analyses for that by picking the date values would be filtered automatically
Thanks Zebhashmi. I have the below code already in the app.
I tried your suggestion to add back in the Master Calendar now using the 'Date Field' but it still gives a synthetic key because I'm using the same unique identifier
//===================================================
// Subroutine to Generate Calendar.
//===================================================
SUB CalendarFromField(_field, _calendar, _prefix)
[$(_calendar)]:
// Generate Final Calendar
LOAD
[$(_field)]
,year([$(_field)]) as [$(_prefix)Year]
,month([$(_field)]) as [$(_prefix)Month]
,day([$(_field)]) as [$(_prefix)Day]
,weekday([$(_field)]) as [$(_prefix)Weekday]
;
// Generate range of dates between min and max.
LOAD
date(DateMin + IterNo()) as [$(_field)] // Link Field
WHILE DateMin + IterNo() <= DateMax
;
// Find min and max of date field values.
LOAD
min(datefield)-1 as DateMin
,max(datefield) as DateMax
;
// Load date field values.
LOAD
FieldValue('$(_field)', RecNo()) as datefield
AutoGenerate FieldValueCount('$(_field)');
END SUB