Once I figured out how SUMMARIZE worked this worked out great. I ended up with the following formula.
06 mos Post ALC Med =
MEDIANX (
SUMMARIZE (
FILTER ( ‘ALC ER Visits’, ‘ALC ER Visits’[06 Mos Post-ALC ERs] = 1 ),
‘ALC ER Visits’[Visit HCN],
“Visit Count”, SUM ( ‘ALC ER Visits’[06 Mos Post-ALC ERs] )
),
[Visit Count]
)
This is awesome! Where possible I prefer to use Power Query in lieu of writing DAX. Unfortunately this particular solution will not work for me this time. The 06 Mos Post-ALC ERs values are calculated based on the difference between two dates. If the difference between the dates is 6 months or less, then the value is 1 otherwise it is zero. I was unable to find a way to calculate this in Power Query.
The Visit HCN is the identifier.
The admit date is a hospital admission date.
The discharge date is a hospital discharge date.
The ER Admission Date/Time is an emergency room visit.
What I need to figure out in Power Query is:
Is the ER Admission Date within 6 months prior to admission.
Do you think this can be done? I couldn’t find any resources for this.
Glad to help. No reason to bang your head against the wall for days - when you get stumped just give the forum a shout. Lots of super knowledgeable folks here eager to assist.