Forum Discussion
Need Help with Dax
- 1 year ago
Hi Krushnab85 ,
To ensure that the calendar filters the correct stage date dynamically, modify your measures using ALL to ignore the active relationship and then apply the correct date filter using TREATAS.
Enrollments Count (Respects Active Relationship)No_of_Enrollments = COUNT(Patient_Fact[Patient ID])(This works as expected since Cal_Date >> Enrollment Date is active)
Admissions Count
No_of_Admissions = CALCULATE( COUNT(Patient_Fact[Patient ID]), ALL(Patient_Fact), -- Removes any filter from Enrollment Date TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Admission Date]) )
Billings CountNo_of_Billings = CALCULATE( COUNT(Patient_Fact[Patient ID]), ALL(Patient_Fact), TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Billing Date]) )
Infusions CountNo_of_Infusions = CALCULATE( COUNT(Patient_Fact[Patient ID]), ALL(Patient_Fact), TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Infusion Date]) )Please mark this post as solution if it helps you. Appreciate Kudos.
FarhanJeelani Any suggestions?
Hi Krushnab85 ,
To ensure that the calendar filters the correct stage date dynamically, modify your measures using ALL to ignore the active relationship and then apply the correct date filter using TREATAS.
Enrollments Count (Respects Active Relationship)
No_of_Enrollments = COUNT(Patient_Fact[Patient ID])
(This works as expected since Cal_Date >> Enrollment Date is active)
Admissions Count
No_of_Admissions =
CALCULATE(
COUNT(Patient_Fact[Patient ID]),
ALL(Patient_Fact), -- Removes any filter from Enrollment Date
TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Admission Date])
)
Billings Count
No_of_Billings =
CALCULATE(
COUNT(Patient_Fact[Patient ID]),
ALL(Patient_Fact),
TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Billing Date])
)
Infusions Count
No_of_Infusions =
CALCULATE(
COUNT(Patient_Fact[Patient ID]),
ALL(Patient_Fact),
TREATAS( VALUES(Calendar[Cal_Date]), Patient_Fact[Infusion Date])
)
Please mark this post as solution if it helps you. Appreciate Kudos.