0
0
Power BIbi_tool~5 mins

COUNT and DISTINCTCOUNT in Power BI - Step-by-Step Guide

Choose your learning style9 modes available
Introduction
These two functions help you count items in your data. COUNT counts all numbers or non-blank values in a column. DISTINCTCOUNT counts only unique values, ignoring duplicates. They help you understand how many items or unique items you have.
When you want to know how many sales transactions happened in total.
When you need to find out how many different customers bought products.
When you want to count how many products were sold, including duplicates.
When you want to count how many unique product categories appear in your sales data.
When you want to check how many dates have sales records.
Steps
Step 1: Open your Power BI Desktop file
- Power BI Desktop main window
Your report and data model are visible
Step 2: Click on the Modeling tab
- Ribbon at the top
Modeling options appear
Step 3: Click New Measure
- Modeling tab
A formula bar appears to enter a DAX formula
Step 4: Type the formula for COUNT, for example: Total Sales Count = COUNT(Sales[Quantity])
- Formula bar
A new measure named Total Sales Count is created that counts all Quantity values
Step 5: Click New Measure again
- Modeling tab
Formula bar appears for a new measure
Step 6: Type the formula for DISTINCTCOUNT, for example: Unique Customers = DISTINCTCOUNT(Sales[CustomerID])
- Formula bar
A new measure named Unique Customers is created that counts unique CustomerID values
Step 7: Add a card visual to the report canvas
- Visualizations pane
An empty card appears on the canvas
Step 8: Drag the Total Sales Count measure to the card
- Fields pane to card visual
The card shows the total count of sales quantities
Step 9: Add another card visual and drag the Unique Customers measure to it
- Visualizations pane and Fields pane
The second card shows the count of unique customers
Before vs After
Before
Report canvas has no cards and no measures for counting
After
Report canvas shows two cards: one with total count of sales quantities (e.g., 1500), another with unique customer count (e.g., 120)
Settings Reference
New Measure
📍 Modeling tab in the ribbon
To create custom calculations like COUNT and DISTINCTCOUNT
Default: No measure created
Visualizations pane
📍 Right side of Power BI Desktop
To add visuals that display your data and measures
Default: No visual selected
Common Mistakes
Using COUNT on a text column
COUNT only counts numbers and non-blank values, so it may return unexpected results or zero
Use DISTINCTCOUNT for text columns to count unique text values or use COUNTROWS with filters
Confusing COUNT with COUNTROWS
COUNT counts values in a single column, COUNTROWS counts rows in a table or filtered table
Use COUNT for counting values in one column, COUNTROWS to count rows in a table or filtered table
Summary
COUNT counts all values in a column, including duplicates.
DISTINCTCOUNT counts only unique values in a column.
Use these measures to quickly see totals and unique counts in your reports.