Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

COUNTROWS FILTER - Multiple Values

Hello,    I have a column that has a number of 1's and 0's and I want to count how many 1's there are and 0's there are as they are base don a different column.    I have tried to use the below m...
  • v-kelly-msft's avatar
    6 years ago

    Hi Anonymous ,

     

    You need to split your measure into 2,1 is for calculating the number of 1's and the other is for the number of  0's:

    If the data of the column is a text type,using:

     

    Measure for 1 = CALCULATE(
                            COUNTROWS(Table_query),
                            FILTER(Table_query, Table_query[Recharge Decision] = "1")
    Measure for 0= CALCULATE(
                            COUNTROWS(Table_query),
                            FILTER(Table_query, Table_query[Recharge Decision] ="0"),

     

    If the data of the column is a whole number type,using:

     

    Measure for 1 = CALCULATE(
                            COUNTROWS(Table_query),
                            FILTER(Table_query, Table_query[Recharge Decision] = 1)
    Measure for 1 = CALCULATE(
                            COUNTROWS(Table_query),
                            FILTER(Table_query, Table_query[Recharge Decision] = 0)

     

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!