How to Count Yes and No in Power BI
Trying to count simple "Yes" and "No" answers in Power BI can sometimes feel more complicated than it should be. If you've ever found yourself digging through DAX functions just to tally binary responses from a survey or a feedback form, you're not alone. This guide breaks down the easiest and most practical methods to count "Yes" and "No" values, so you can move from raw data to clear insights without the headache.
Why Counting 'Yes' and 'No' is So Important
First, let's acknowledge why this is such a common task. Counting binary responses is fundamental to understanding customer behavior, employee sentiment, marketing performance, and operational efficiency. You might be analyzing:
- Survey Results: Did customers find your new feature helpful? (Yes/No)
- Marketing Opt-ins: Has a user subscribed to the newsletter? (Yes/No)
- Sales Follow-ups: Was the follow-up call completed? (Yes/No)
- Inventory Checks: Is the item in stock? (Yes/No)
- Task Completion: Did the project milestone meet the deadline? (Yes/No)
The ability to accurately count and visualize these responses allows you to quickly gauge success rates, identify problem areas, and track progress toward your goals. It turns a simple column of text into a performance indicator.
Before You Begin: Always Clean Your Data
Before you write a single DAX formula, a quick trip to the Power Query Editor can save you a world of trouble. The most common cause for inaccurate counts is inconsistent data entry. Look out for:
- Case variations: "Yes", "yes", "YES"
- Extra spaces: " Yes" or "No "
- Misspellings or variations: "Y", "N", "true", "false"
- Null or blank values: Empty cells where an answer should be.
To fix this, open the Power Query Editor (click "Transform data" on the Home ribbon). Right-click the column header of your Yes/No data and use the "Transform" options to apply these changes:
- Trim: Removes leading and trailing whitespace. (Transform > Format > Trim)
- Clean: Removes non-printable characters or line breaks (Transform > Format > Clean)
- Capitalize Each Word (or Lowercase/Uppercase): This makes all entries uniform. Capitalizing to "Yes" and "No" is a clean standard. (Transform > Format > Capitalize Each Word)
- Replace Values: A method to standardize variations like "Y" to "Yes" and "N" to "No". (Right-click column > Replace Values...)
Once your data is clean and consistent, click "Close & Apply." Now you're ready to start counting with confidence.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 1: The Quickest Visual Count (No Formulas Needed)
If you just need a fast, visual breakdown and don't require reusable calculations, you can do this directly on the report canvas.
Let's say you have a table named 'CustomerSurvey' with a column called [SatisfactionResponse] that contains your "Yes" and "No" values.
- Drag a visual like a Stacked Column Chart, Pie Chart, or Donut Chart onto your canvas.
- From the Data pane, drag your
[SatisfactionResponse]column into the Legend field (for pie charts) or the X-axis field (for column charts). - Drag the same
[SatisfactionResponse]column into the Values field.
Power BI will automatically perform a "Count of SatisfactionResponse," instantly showing you how many instances of each unique value - "Yes" and "No" - exist in the column. This is great for a quick look but isn't very flexible if you want to calculate percentages or use these counts in more complex analyses.
Method 2: Using DAX Measures (The Most Powerful Approach)
For more control, flexibility, and reusability, DAX (Data Analysis Expressions) measures are the way to go. A measure is a calculation that is performed on the fly based on the context of your report (like filters from slicers or other visuals). This is the standard, best-practice way to perform custom calculations in Power BI.
We'll create two separate measures: one for "Yes" and one for "No." On the Home ribbon, click "New Measure."
The CALCULATE and COUNT Approach (Recommended)
This method uses the CALCULATE function, one of the most important functions in DAX. It modifies the filter context to perform a calculation on a specific subset of your data.
In the formula bar, enter the following DAX formula to count the "Yes" responses:
Yes Count = CALCULATE(
COUNT('CustomerSurvey'[SatisfactionResponse]),
'CustomerSurvey'[SatisfactionResponse] = "Yes"
)Here's what this does:
COUNT('CustomerSurvey'[SatisfactionResponse]): Counts all the non-blank rows in the specified column.'CustomerSurvey'[SatisfactionResponse] = "Yes": This is the filter. We're tellingCALCULATEto only perform the count where the value in the response column is exactly "Yes."
Now, create another measure for the "No" count:
No Count = CALCULATE(
COUNT('CustomerSurvey'[SatisfactionResponse]),
'CustomerSurvey'[SatisfactionResponse] = "No"
)The COUNTROWS and FILTER Approach
An alternative method uses the COUNTROWS function, which counts the number of rows in a table. We first use FILTER to create a virtual table containing only the rows we want to count.
Create a new measure and enter this formula:
Yes Count (Filter) = COUNTROWS(
FILTER(
'CustomerSurvey',
'CustomerSurvey'[SatisfactionResponse] = "Yes"
)
)This formula says:
- First,
FILTERthe'CustomerSurvey'table to only include rows where the[SatisfactionResponse]is "Yes." - Then, use
COUNTROWSto count how many rows are in that filtered table.
Both the CALCULATE and COUNTROWS(FILTER(...)) methods achieve the same result. However, for this type of calculation, CALCULATE is generally considered more efficient and is often easier for newcomers to DAX to read and understand.
Using Your New Measures in Visuals
Once you've created your measures, you can use them anywhere in your report. The best way to display them is often in Card visuals.
- Add two Card visuals to your report canvas.
- Drag your
[Yes Count]measure to the field well of the first card. - Drag your
[No Count]measure to the second card.
Now you have clean, clear totals that will dynamically update as you apply filters (e.g., filtering by date, product line, or customer region). You can also use these measures in tables, charts, and matrices to add rich context to your analysis.
Bonus: Calculating the Percentage of 'Yes' Responses
A common follow-up question is "What percentage of the total responses were 'Yes'?" Creating this with measures is straightforward.
First, create a measure to get the total number of responses (this will serve as our denominator).
Total Responses = COUNT('CustomerSurvey'[SatisfactionResponse])Next, create the percentage measure, using the DIVIDE function to handle potential divide-by-zero errors gracefully.
% Yes = DIVIDE([Yes Count], [Total Responses])After creating this measure, select it in the Data pane and use the "Measure tools" ribbon at the top to change the format to a percentage. Now you can drop this measure into a Card or a Gauge visual for an instant KPI.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 3: Using a Calculated Column (Use Sparingly)
Another option is to create a Calculated Column. Unlike a measure, a calculated column computes a value for each individual row in your table and stores that value in memory. This can be useful in some scenarios but is generally less efficient than measures for simple aggregations like this.
Why would you use it? If you need to use the Yes/No count as a filter or axis in a visual, a column can be necessary. For example, creating a "helper" column of 1s and 0s.
Go to the Data View, select your table, and click "New column" under the "Table tools" ribbon.
Create a column that flags "Yes" responses with a 1:
Is_Yes = IF('CustomerSurvey'[SatisfactionResponse] = "Yes", 1, 0)Then, create another for "No" responses:
Is_No = IF('CustomerSurvey'[SatisfactionResponse] = "No", 1, 0)Now, back in the report view, you can simply drag these new columns into a Card visual. Power BI will default to summing them, giving you your total "Yes" and "No" counts. While this works, it adds static data to your model, increasing its size. For simple counting, measures are almost always the better choice.
Final Thoughts
Mastering how to count values like "Yes" and "No" is a foundational skill in Power BI. While a quick visual count works for simple charts, learning to build DAX measures with functions like CALCULATE or COUNTROWS gives you far more flexibility, power, and reusability for all your reporting needs.
We know that learning DAX and navigating a complex tool like Power BI takes time and effort. It's frustrating to spend hours wrangling formulas when you just need a straightforward answer. At Graphed, we've designed a platform that eliminates this complexity. We allow you to connect your data sources, then simply ask questions in plain English, like "Show me a pie chart of yes vs. no responses from our latest customer survey." Graphed automatically generates interactive dashboards and reports for you in seconds, turning hours of tedious report-building into a quick, conversational task.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.