Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

COUNTAX not working to count names

Hello friends, 


I have this table (Table1)




How can I count the number of "Yes" and "No" in Power Pivot?

Im using COUNTAX in this way:


Number of YES:= COUNTAX (Table1; ([OK]="Yes")) 


I haven´t results with it... Could somebodi help me?

Thank you from Spain!

Frequent Visitor

Im working in the pivot table. 

The colum [OK] is not calculated

Please try

YES :=
CALCULATE ( COUNTROWS ( Table1 ); ALL ( Table1 ); Table1[OK] = "Yes" )

It Works! great! thank you a lot!!

Now if I have date data, can I calculate the TOTALYTD? or I have to carry ou any modified in the values?


For time intellegence functions always use a date table marked as date table. But I don't know how is this related to your orioginal query?

Yes, I have a date table created.

=TOTALYTD([YES]; calendar[Date])... but it doesn´t works,

new problem in my way


Are you slicing by date? Can you please share a screenshot of the visual?

Of Course!



I'm talking about the pivot table. Can you share a screenshot of it?

This is te pivot table...






My friend where are you using this measure? When you say year to date you should be slicing by a date otherwise which date the function will consider?! The screenshot shows the power pivot table not the pivot table visual. The value show here is the grand total and the YTD has no meaning in the grand total! Please help me undestand what exactly are you trying to acheive. We can also connect via zoom or teams. I have some free time now if you wish.

Hello @tamerj1 thank you for your time.

Today im quite bussy but i want yo explain properly want I need, so, if you are able to helpme i´ll be very grateful

Super User
Super User

Hi @Josevi 

is [OK] a measure or a column in the source data? How are you displying the result?

Hello tamerj1, thank you.

OK is the name of the Colum and  the values ("Yes" or "NO") of this colum are text format.

Do you need more information?

Please try

YES :=
CALCULATE ( COUNTROWS ( Table1 ); Table1[OK] = "Yes" )

Thank you!

I´ve tried it but doesnt work...😓

How are displaying the results? In a the same pivot table? or this is a calculated column?

Helpful resources

Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors