Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
5 years ago
Solved

Sum and average with multiple filters

Hello everyone. I have a table with data of procedures carried out, such as the following: Codigo_Obra Through Estado_Aprob Total Term Meets deadline 2609 15401 APPROVED 42 Defeated ...
  • v-jingzhang's avatar
    5 years ago

    Hi Syndicate_Admin 

     

    Try something like below for average with multiple conditions.

    Dias_AprobOK =
    CALCULATE (
        AVERAGE ( Data[Total Term] ),
        Data[Estado_Aprob] = "APPROVED",
        Data[Meets deadline] = "OK"
    )
    

    Or

    Dias_AprobOK =
    AVERAGEX (
        FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
        Data[Total Term]
    )
    

     

    If you want a blank value to appear like a zero, you can add +0 at the end of your formula. Something like

    Dias_AprobOK =
    AVERAGEX (
        FILTER ( Data, Data[Estado_Aprob] = "APPROVED" && Data[Meets Deadline] = "ok" ),
        Data[Total Term]
    ) + 0 
    

     

    You can use && to connect multiple filtering conditions. See DAX syntax.

     

    Let me know if you have any questions.

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.