Forum Discussion

NithinBN's avatar
NithinBN
Helper II
5 years ago
Solved

Multiple Filter (Countrows) which includes Text and boolean

Hello All,

I want to count rows based on filters which includes both text and boolean values.

 

Here  is my query which includes both text and boolean.

Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green"),FILTER(Table1,Table1[Active]="True"))

 

but its throwing error as i cant use both text and boolean in filter.

 

Any other option than changing boolean type  to text ?

 

Thanks,

  • NithinBN , if active is boolean first two should work. else try thrid one

     


    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]))

    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]=true()))

     

    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]="True"))

3 Replies

  • NithinBN , if active is boolean first two should work. else try thrid one

     


    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]))

    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]=true()))

     

    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green" && Table1[Active]="True"))

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi NithinBN ,

     

    Because your Active column is boolean values, the judgment statement Table1[Active]=TRUE does not need to add quotation marks.

    Overall_Green = CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[colour]="Green"),FILTER(Table1,Table1[Active]=TRUE))

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    NithinBN Try:

    Overall_Green = 
      COUNTROWS(
        FILTER(Table1,Table1[colour]="Green" && Table1[Active]="True")
      )