# COUNTAX with filter criteria and DISTINCTCOUNT



## IinCircle (Jul 3, 2014)

Store
Product
A
Apple
A
Orange
A
Apple
A
Pear
B
Apple
B
Apple
C
Orange
C
Orange
C
Pear
D
Apple


<tbody>

</tbody>Hi, I tried to have a formula combining COUNTAX and DISTINCTCOUNT but keeps getting an error message.

I want to count the number of Stores that sold Apple, which in this case is 3.
=CONTAX(FILTER(Table,[Product]="Apple",[Product])AND(DISTINCTCOUNT(Store))


----------



## IinCircle (Jul 3, 2014)

Another formula I tired: 
=ALATE((DISTINCTCOUNT(STORE),(FILTER(TABLE,[PRODUCT]="APPLE"))


----------



## scottsen (Jul 4, 2014)

That 2nd attempt looks good, if you fix up your syntax:

=CALCULATE(DISTINCTCOUNT(Table1[Store]), FILTER(Table1, Table1[Product] = "Apple"))


----------

