Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX Formula

I am having a hard time figuring out how to write a countif formula in DAX.

 

=countif(table a, "Yes")/countif(tableb,Total)

 

so basically a % formula.. can anyone assist?

  • Anonymous try this, add following as a measure

     

    My Measure =
    DIVIDE
    (
    CALCULATE( COUNTROWS( TableA ), TableA[Column] = "Yes" ),
    CALCULATE( COUNTROWS( TableB ), TableB[Column] = "Total" )
    )
    

2 Replies

  • Anonymous try this, add following as a measure

     

    My Measure =
    DIVIDE
    (
    CALCULATE( COUNTROWS( TableA ), TableA[Column] = "Yes" ),
    CALCULATE( COUNTROWS( TableB ), TableB[Column] = "Total" )
    )
    
    • Anonymous's avatar
      Anonymous
      Not applicable

      Parry,

       

      Thanks so much. Being new to DAX, i keep wanting to write in Excel code or other code language.

       

      This works perfectly!