Forum Discussion

pdoucette's avatar
pdoucette
Frequent Visitor
5 years ago
Solved

Distinct Count Measure

Hi All, I have the following table:   Client Admission Date Discharge Date   My goal is to get the distinct count of clients who were active during a given date range 7/1/19 - 6/30/20.  I...
  • dedelman_clng's avatar
    dedelman_clng
    5 years ago

    That is just a matter of adding another test in the FILTER statement

     

     

     

    FY20 = 
    CALCULATE (
        DISTINCTCOUNT ( ActiveOpen[Client] ),
        FILTER (
            ActiveOpen,
            ( ( ActiveOpen[Admission Date] <= DATE ( 2020, 6, 30 )
                && ISBLANK ( ActiveOpen[Discharge Date] ) )
                || ( ActiveOpen[Admission Date] <= DATE ( 2020, 6, 30 )
                    && ActiveOpen[Discharge Date] >= DATE ( 2019, 7, 1 ) ) ) &&
                        NOT(ISBLANK(ActiveOpen[Admission Date]) && ISBLANK(ActiveOpen[Discharge Date]))
        )
    )
    

     

    Make sure the NOT surrounds both ISBLANK statements in the last line.

     

    Hope this helps

    David