Forum Discussion

mihaita_baro's avatar
mihaita_baro
Helper II
4 years ago
Solved

First occurence based on two filters

Hi there   I have a table where i store multiple appoiments for the same clients.    I need to calculate something called KPI4, which means the first appoiment where AppType is 2,3 or 5 and Atten...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    4 years ago

    Hello mihaita_baro 

     

    You can create a column like this:

    KPI_5 = 
    VAR a =
        IF (
            COUNTX ( FILTER ( ALL ( 'Table' ), [ID] = EARLIER ( 'Table'[ID] ) ), [ID] ) >= 2,
            1
        )
    RETURN
        IF (
            a = 1
                && [APPTYPE]
                    IN { 2, 3, 5 }
                        && [ATTENDANCE] IN { 5, 6, BLANK () },
            1
        )

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please feel free to ask me.

     

    Best Regards,
    Community Support Team _ Janey