Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Josevi
Frequent Visitor

COUNTAX not working to count names

Hello friends, 

 

I have this table (Table1)

 

TypeOK
1Yes
2Yes
3NO
4NO
5Yes
6NO
7NO
8NO

 

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!

16 REPLIES 16
Josevi
Frequent Visitor

Im working in the pivot table. 

The colum [OK] is not calculated

@Josevi 
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?

 

@Josevi 
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

 

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

Of Course!

Josevi_0-1655213282684.png

 

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

This is te pivot table...

 

Josevi_0-1655215737814.png

Josevi_1-1655215762689.png

 

 

@Josevi 
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

tamerj1
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?

@Josevi 
Please try

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

Thank you!

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

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

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors