Forum Discussion
Active patients when slicing by date
- 4 years ago
You likely want a measure pattern similar to this one. This assumes that you have a Date table and there is no relationship to from it to the table with your patient data. If you do have a relationship, you can add REMOVEFILTERS(PatientTable) into the CALCULATE.
Active employees =
VAR mindate =
MIN ( Date[Date] )
VAR maxdate =
MAX ( Date[Date] )
RETURN
CALCULATE (
COUNT ( Table[Employee] ),
AND (
Table[StartDate] <= maxdate,
OR ( Table[TerminationDate] >= mindate, ISBLANK ( Table[TerminationDate] ) )
)
)Pat
- 4 years ago
For Count refer to this:
Active employees = VAR mindate = MIN ( DateTable[Date] ) VAR maxdate = MAX ( DateTable[Date]) RETURN CALCULATE ( COUNT ( Admissions[PatientID] ), AND ( Admissions[AdmitDate] <= maxdate, OR ( Admissions[DischargDateFixed] >= mindate, ISBLANK ( Admissions[DischargDateFixed] ) ) ) )However, this is the same thing but rewritten which mahoneypat proposed earlier. That works, so kudos to this man.
For Count refer to this:
Active employees =
VAR mindate =
MIN ( DateTable[Date] )
VAR maxdate =
MAX ( DateTable[Date])
RETURN
CALCULATE (
COUNT ( Admissions[PatientID] ),
AND (
Admissions[AdmitDate] <= maxdate,
OR ( Admissions[DischargDateFixed] >= mindate, ISBLANK ( Admissions[DischargDateFixed] ) )
)
)However, this is the same thing but rewritten which mahoneypat proposed earlier. That works, so kudos to this man.
I don't know if I can accept two solutions but you were very helpful. That is great. Thanks for your help. I used the other measure, though.