I am trying to compare data from two queries, one with primary admissions and one with readmissions.
For each readmission I want to count the number of primary admissions which has occurred within 30 days prior to the readmission. See the tables below for an example (the greycells in the readmissions is the variable I am trying to create)
I have tried this
NoOfPrimary = Count([Primary].[log ID] In (Patient ID)) where (DaysBetween([Primary].[Discharge date];[Readmission].[Hospitalize date]) < 30) In (Readmission].[log ID])
where the [Primary].[Patient ID] and the [Readmission].[Patient.ID] are merged.
This provide the result #ERROR
Furthermore I have tried to create details for the date dimensions and tried with the same formula. This provide the result #CONTEXT
Any ideas how to solve this?