A sales manager asked me for a simple Power BI page: how many orders each region placed, and how many of them were over $5,000. The first number took one measure. The second one showed blanks on half the rows, and a third count came back the same on every region.
Counting in DAX looks easy because COUNT works like it does in Excel. But a filter inside CALCULATE replaces the row’s filter, empty results show as blank instead of 0, and a distinct count total never adds up.
In this tutorial, we’ll build every power bi dax count measure I use on one sales file: COUNT, COUNTA, COUNTROWS, DISTINCTCOUNT and COUNTBLANK, a count with a condition, COUNTX, a count from another table and a count with no DAX at all. Every number is what Power BI Desktop showed me on 11/21/2026.
Quick answer: Use COUNTROWS(Sales) to count rows, COUNTA to count non-blank values in one column and DISTINCTCOUNT for unique values. To count with a condition, wrap COUNTROWS in CALCULATE: CALCULATE(COUNTROWS(Sales), Sales[Sales] > 5000). Add + 0 at the end when you want 0 instead of a blank.
The Sample Sales Data I Count in Power BI
My demo files load into one Power BI table, Sales, from SPGuides_Sales_2026.csv: 60 orders from 01/12/2026 to 09/09/2026 across four regions. Every row has an OrderID, a City and a Sales amount, so there are no blank cells. A few of the rows:
| OrderID | OrderDate | Region | Category | Product | SalesRep | Quantity | Sales |
|---|---|---|---|---|---|---|---|
| SO-1020 | 01/12/2026 | West | Software | Visio Plan 2 | Rachel Morgan | 8 | $1,440 |
| SO-1037 | 02/22/2026 | South | Software | Visio Plan 2 | Tyler Brooks | 5 | $900 |
| SO-1024 | 03/27/2026 | East | Accessories | Surface Keyboard | Tyler Brooks | 7 | $903 |
| SO-1055 | 08/08/2026 | Central | Software | Project Plan 3 | Tyler Brooks | 4 | $1,440 |
| SO-1017 | 08/27/2026 | West | Laptops | ThinkPad X1 | Rachel Morgan | 6 | $8,694 |
| SO-1032 | 09/09/2026 | East | Laptops | ThinkPad X1 | Rachel Morgan | 4 | $5,796 |
To add each measure, select New measure on the Home ribbon, type the formula and press Enter. With a dozen count measures, a separate measure table keeps the Data pane tidy. The same rows could come from a SharePoint list or an Excel workbook; the DAX doesn’t change.
COUNT vs COUNTA vs COUNTROWS vs DISTINCTCOUNT in DAX
I added one measure per counting function and put them in a Power BI table visual next to Region:
Sales Count (COUNT) = COUNT(Sales[Sales])
Order IDs (COUNTA) = COUNTA(Sales[OrderID])
Order Rows (COUNTROWS) = COUNTROWS(Sales)
Products Sold (DISTINCTCOUNT) = DISTINCTCOUNT(Sales[Product])
Blank Cities (COUNTBLANK) = COUNTBLANK(Sales[City])

COUNT, COUNTA and COUNTROWS all returned Central 3, East 32, South 10 and West 15, with 60 on the Total row. DISTINCTCOUNT returned 3, 9, 6 and 7 products, and its Total is 9, not the sum. The COUNTBLANK column stayed empty.
Here’s how they differ, even when the numbers match:
| Function | What it counts | Watch for |
|---|---|---|
| COUNT(column) | Non-blank numbers, dates and text in one column | Doesn’t support TRUE/FALSE columns |
| COUNTA(column) | Non-blank values of any type, including TRUE/FALSE | Skips blank cells |
| COUNTROWS(table) | Rows in a table or a table expression | Ignores blanks in columns |
| DISTINCTCOUNT(column) | Unique values, counting BLANK as one value | Totals aren’t additive |
| COUNTBLANK(column) | Blank cells (a zero isn’t blank) | Returns blank, never 0 |
When the goal is “how many rows” in Power BI, I use COUNTROWS. It’s faster than COUNT, it ignores blank cells, and the formula says what it does.
Use COUNT or COUNTA only when you mean “how many filled-in values in this column.” If you’d rather count in Power Query before the data loads, see counting rows and distinct values in Power Query.
DISTINCTCOUNT counts each product once per row of the visual. East sold 9 products and the whole file has 9, because East sells every product. For a distinct count limited to a category or status, read Power BI distinct count with filter.
How to Count With a Condition in Power BI DAX
Power BI has no COUNTIF function. The Excel COUNTIF idea becomes CALCULATE plus COUNTROWS, where the second argument is the condition. Same Sales table, now only orders over $5,000:
Orders Over 5000 = CALCULATE(COUNTROWS(Sales), Sales[Sales] > 5000)
West returned 5, East 7 and the Total 12. South and Central came back blank, because none of their orders is over $5,000 and COUNTROWS returns blank for an empty table.
You can also write it with FILTER, which reads closer to a row-by-row test:
Orders Over 5000 (FILTER) = COUNTROWS(FILTER(Sales, Sales[Sales] > 5000))
It returned exactly the same numbers. I keep the CALCULATE form for a simple column condition and switch to FILTER when the test compares two columns or uses a measure. The same pattern answers “countif greater than 0” in Power BI: CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 0).
To show 0 instead of a blank, add zero:
Orders Over 5000 (Zero) = CALCULATE(COUNTROWS(Sales), Sales[Sales] > 5000) + 0

Now South and Central show 0. A blank hides the row in many Power BI visuals, so the + 0 version keeps every region in the table. For a column that already holds TRUE or FALSE, the Power BI count if true post has a shorter pattern.
Why a Count Filter Shows the Same Number on Every Row
This one confuses almost everyone. I counted East orders with a fixed condition:
East Orders = CALCULATE(COUNTROWS(Sales), Sales[Region] = "East")
It showed 32 on every region, including Central and West. The condition Sales[Region] = “East” replaces the row’s Region filter instead of adding to it, so every row counts the East orders.
When you want the condition to work together with the visual’s filter, wrap it in KEEPFILTERS:
East Orders (Keep Filters) = CALCULATE(COUNTROWS(Sales), KEEPFILTERS(Sales[Region] = "East"))
Now East shows 32 and the other regions are blank, which is what most Power BI reports need. The clash only happens when the condition and the visual filter the same column. My DAX MAX with filter post shows the same behavior with dates.
Two conditions in one CALCULATE, such as laptops over $5,000, are separated by a comma. I tested that too (it matched the 12 above, since every order over $5,000 here is a laptop), but the full set of AND/OR patterns lives in count data with multiple filter conditions in Power BI.
Count Rows That Pass a Row Test With COUNTX
COUNTX walks through a table and counts the rows where an expression isn’t blank. Paired with FILTER, it counts rows that pass a row-level test. Here, orders with a quantity of 5 or more:
Orders Qty 5 Plus (COUNTX) = COUNTX(FILTER(Sales, Sales[Quantity] >= 5), Sales[OrderID])
Power BI returned West 13, East 14, South 7, Central 1 and a Total of 35, which matches a filter on the CSV. COUNTX counts numbers, dates and text; for a TRUE/FALSE expression use COUNTAX. When the expression is just a column, COUNTROWS(FILTER(…)) gives the same result and is easier to read.
Count in a Power BI Visual Without Writing DAX
For a quick count visual, you don’t need a measure. I added a table visual with Region and OrderID, then opened the OrderID field’s menu in the Columns well:
- In the Visualizations pane, select the > arrow next to OrderID in the Columns well.
- Open the Summarization dropdown. A text column offers Don’t summarize, First, Last, Count (Distinct) and Count.
- Select Count.

The column header changed to Count of OrderID:

It shows Central 3, East 32, South 10, West 15 and 60 in total, the same as the COUNTROWS measure. This is also the simplest DAX group by count: the Region column groups the rows, and the count runs once per group. For grouped tables in DAX itself, see Power BI count group by.
Note: Pick Count (Distinct) instead when the column repeats, like Product. I still prefer a named measure for anything reused across pages, because you can format it and use it in other measures.
Power BI COUNTIF From Another Table
Sometimes the count belongs on a different table. My model has a ‘Sales Reps’ table with one row per rep, related one-to-many to Sales on SalesRep. To count each rep’s orders, I added a Power BI calculated column on ‘Sales Reps’:
Total Orders = COUNTROWS(RELATEDTABLE(Sales))

Brian Keller has 11 orders, Dana Whitfield 11, Marcus Hale 17, Rachel Morgan 12 and Tyler Brooks 9, which adds up to the 60 orders in Sales. RELATEDTABLE follows the relationship from the rep’s row and returns only that rep’s Sales rows.
To count from another table with a condition, use CALCULATE inside the column. I flagged large orders on Sales first, then counted them per rep:
Is Large Order = Sales[Sales] >= 5000
Large Order Count = CALCULATE(COUNTROWS(Sales), Sales[Is Large Order] = TRUE()) + 0
Brian Keller and Rachel Morgan each have 5 large orders, Marcus Hale 2, and Dana Whitfield and Tyler Brooks 0, for 12 in total. Row context on ‘Sales Reps’ becomes a filter on Sales through the relationship. A measure works too; read calculated column vs measure in Power BI to pick one.
DAX Count Results That Look Wrong (and the Fix)
- Blank instead of 0: COUNT, COUNTA, COUNTROWS and COUNTX return blank when no rows match. Add + 0, as in Orders Over 5000 (Zero).
- COUNTBLANK shows nothing: it returns blank, never 0, when a column has no blank cells. My Blank Cities measure stayed empty for that reason. A zero isn’t a blank either.
- The same count on every row: a CALCULATE condition on the column the visual groups by overrides it. Wrap it in KEEPFILTERS.
- Distinct total smaller than the rows: that’s correct. A product sold in two regions is still one product on the Total row.
- COUNT on a TRUE/FALSE column: COUNT doesn’t support it. Use COUNTA, or COUNTROWS with a condition.
- DirectQuery: these count functions aren’t supported in calculated columns or row-level security rules in DirectQuery mode, so keep the logic in measures.
Where Power BI Count Measures Fit Next
Power BI DAX count measures follow every slicer and filter on the page, so the same Orders Over 5000 measure works on a card, in a matrix or behind conditional formatting.
In a Power BI summary row, counts pair well with the Power BI DAX MAX function and the DAX MIN function for a summary row.
If the data lives in Power Apps instead, CountRows and CountIf do the same job there. For more tested DAX patterns, browse the Power BI tutorials on SPGuides.
If you count and filter data in Power BI and Power Apps, these walkthroughs pick up from here:
Power BI DAX Count Questions, Answered
How do I count with a condition in Power BI DAX?
Wrap COUNTROWS in CALCULATE and add the condition, for example CALCULATE(COUNTROWS(Sales), Sales[Sales] > 5000). COUNTROWS(FILTER(Sales, Sales[Sales] > 5000)) returns the same count.
How do I write COUNTIF greater than 0 in Power BI?
Use CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 0), with your own table and column. Add + 0 at the end if rows with no matches should show 0 instead of blank.
How do I count from another table in Power BI?
If the tables are related, add a calculated column on the one-side table with COUNTROWS(RELATEDTABLE(Sales)). For a condition, use CALCULATE(COUNTROWS(Sales), Sales[Is Large Order] = TRUE()) + 0.
Why does my DAX count return blank instead of 0?
COUNTROWS, COUNT and COUNTA return blank when no rows match the filters, and COUNTBLANK returns blank when there are no blank cells. Add + 0 to the measure to show 0.
What’s the difference between COUNT and COUNTROWS in DAX?
COUNT counts non-blank values in one column; COUNTROWS counts the rows of a table, so blank cells don’t change it. To count rows, use COUNTROWS, as the COUNTROWS best practice explains.

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.