Forum Discussion

Creative_tree88's avatar
1 year ago
Solved

What am I not doing here...?

Am I being really stupid...I cannot get this DAX to work.  I have the field Activity[Event Date] but this DAX is adding an extra element to it i.e. Activity[Event Date].[Date] This is clearly what...
  • bhanu_gautam's avatar
    1 year ago

    Creative_tree88 , Try using updated measure

    IR Lookup Exam Date Range =
    VAR _start = 'SLAM Data May 24'[Admission Date]
    VAR _end = 'SLAM Data May 24'[Discharge Date]
    VAR _key = 'SLAM Data May 24'[PMI]

    VAR _singleDateExam =
    LOOKUPVALUE(
    Activity[Examinations],
    Activity[Event Date], _start,
    Activity[Best Hosp No], _key
    )

    VAR _multiDateExams =
    CALCULATE(
    CONCATENATEX(
    FILTER(
    Activity,
    Activity[Event Date] >= _start &&
    Activity[Event Date] <= _end &&
    Activity[Best Hosp No] = _key
    ),
    Activity[Examinations],
    ", "
    )
    )

    RETURN
    IF(
    ISBLANK(_end),
    _singleDateExam,
    _multiDateExams
    )