# How to use COUNTIF in PowerPivot



## mrxlsx (Jan 20, 2014)

I want to use a particular COUNTIFS function in PowePivot. The formula looks like the below. I have all 0s and 1s in the first column called *Atype* and the same 0s and 1s in the next column called *Btype *as well. How to use the below formula in PowerPivot.......=COUNTIFS($B$2:$B$41,1)/COUNTIFS($C$2:$C$41,">="&0)... my sheet name is "Sheet1"

thank you in advance
mrxlsx


----------



## francoisdublin (Jan 28, 2014)

You would create a measure in the calculation area of your PowerPivot table and give it a name e.g. "number_of_a"

then use this syntax



> number_of_a:=CALCULATE(countrows(Table1),Table1[a type]=1)



which is the equivalent of this part of your expression 





> =COUNTIFS($B$2:$B$41,1)



Hope this helps.


----------



## mrxlsx (Jan 28, 2014)

Hi francoisdublin, I will try this and come back. Thanks a lot for your effort.


----------

