Forum Discussion

learning_dax's avatar
learning_dax
Helper II
4 years ago
Solved

CALCULATE + Multiple Filters

Hi all,    I am comparing thetwo Date columns in the below screenshot (this is not the real dataset of course so there are more dates dating back to years prior). I am comparing YoY averages of the...
  • OwenAuger's avatar
    OwenAuger
    4 years ago

    Yes, you sure can 🙂

     

    You can change the AVERAGEX expression as follows to check that both dates are nonblank (using Wait_Time Base as an example):

    Wait_Time Base =
    AVERAGEX (
        'Table',
        VAR StartDate = 'Table'[Start Date]
        VAR InterviewDate = 'Table'[Interview Date]
        RETURN
            IF (
                AND ( NOT ISBLANK ( StartDate ), NOT ISBLANK ( InterviewDate ) ),
                INT ( StartDate - InterviewDate )
                -- Otherwise return blank, which will be ignored by AVERAGEX
            )
    )

    Regards,

    Owen