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 is causing the issue but I'm not entirely sure how to add this [Date] element to make this work.  Thanks in advance.  Here's the entire script for your reference:

 

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].[Date], _start,
       Activity[Best Hosp No], _key
    )

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

RETURN
IF(
    ISBLANK(_end),
    _singleDateExam,
    _multiDateExams
)
  • 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
    )

1 Reply

  • 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
    )