Forum Discussion

cristianml's avatar
cristianml
Post Prodigy
6 years ago
Solved

2 filters dAX

Hi,

 

This formula is not working, not sure where is the mistake. Could you help me ?

 

=CALCULATE(SUM(BR[Value]),
FILTER(BR,BR[BR Report]="Revenue"),FILTER(BR,BR[Type]="MTD Actual"))

 

I need to calculate the column "Value" but filtering by 2 categories from 2 different columns.

Thanks and regards.

  • Hi,

     

    Please try this:

    =
    CALCULATE (
        SUM ( BR[Value] ),
        FILTER ( BR, BR[BR Report] = "Revenue" && BR[Type] = "MTD Actual" )
    )

    If you still have any issue, please share some sample data and the expected result.

    Thanks!

     

    Best Regards,

    Giotto Zhi

  • Hi,

     

    Yeah, if you want to filter many categories, you should add all of them into FILTER function by '&&'.

    And you can also filter them in Filter Pane.

     

    Best Regards,

    Giotto

3 Replies

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    Please try this:

    =
    CALCULATE (
        SUM ( BR[Value] ),
        FILTER ( BR, BR[BR Report] = "Revenue" && BR[Type] = "MTD Actual" )
    )

    If you still have any issue, please share some sample data and the expected result.

    Thanks!

     

    Best Regards,

    Giotto Zhi

    • cristianml's avatar
      cristianml
      Post Prodigy

      Hi v-gizhi-msft ,

       

      How can I filter more than 2 categories? like 4 catogories ?

       

      =CALCULATE(SUM(BR[Value]),FILTER(BR,BR[BR Report]="9. TOTAL RESOURCE COST" && BR[BR Report]="12.2 Net Load / (Load Recoveries)" && BR[Type]="MTD Actual"))

       

      I have to use:  &&  everytime I add a filter ?

       

      Thanks

      • v-gizhi-msft's avatar
        v-gizhi-msft
        Community Support

        Hi,

         

        Yeah, if you want to filter many categories, you should add all of them into FILTER function by '&&'.

        And you can also filter them in Filter Pane.

         

        Best Regards,

        Giotto