Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

CALCULATE using multiple OR filters

Hello

 

I CALCULATE the following:

 

CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[source]=SELECTEDVALUE(Table2[system])))

 

How can I add the following filters in the above calculation please?

 

Table1[field1]<>"" || Table1[field2]<>"" || Table1[field3]<>""
&&
Table1[field4]<>"Y"

 

Thanks!

  • Based on the way you have it stated I think you want to consider it like this:

    CALCULATE (
        COUNTROWS ( Table1 ),
        FILTER (
            Table1,
            Table1[source] = SELECTEDVALUE ( Table2[system] )
                && ( Table1[field1] <> "" || Table1[field2] <> "" || Table1[field3] <> "" )
                && Table1[field4] <> "Y"
        )
    )

    Grouping the or's on 1 2 and 3 together. 

3 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    This will generally do what you want, but you may need to insert parenthesis to group your and/or operators to get the results you are expecting. 

    Measure =
    CALCULATE(
        COUNTROWS( Table1 ),
        FILTER(
            Table1,
            Table1[source]
                = SELECTEDVALUE( Table2[system] )
                && Table1[field1] <> ""
                || Table1[field2] <> ""
                || Table1[field3] <> ""
                && Table1[field4] <> "Y"
        )
    )
    
  • Anonymous 

     

    does this work for you?

     

    CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[source]=SELECTEDVALUE(Table2[system] && (Table1[field1]<>"" || Table1[field2]<>"" || Table1[field3]<>""
    &&
    Table1[field4]<>"Y"))))

    • jdbuchanan71's avatar
      jdbuchanan71
      Icon for Super User rankSuper User

      Based on the way you have it stated I think you want to consider it like this:

      CALCULATE (
          COUNTROWS ( Table1 ),
          FILTER (
              Table1,
              Table1[source] = SELECTEDVALUE ( Table2[system] )
                  && ( Table1[field1] <> "" || Table1[field2] <> "" || Table1[field3] <> "" )
                  && Table1[field4] <> "Y"
          )
      )

      Grouping the or's on 1 2 and 3 together.