How to Do COUNTIF in Power BI with DAX (COUNTIF and COUNTIFS Examples)

Excel users moving to Power BI almost always ask me the same thing first: where’s COUNTIF? A sales manager wanted the number of orders over 10 units, per region, updating with every slicer, and typing =COUNTIF in Power BI got them nowhere.

Power BI has no COUNTIF function, but DAX does the same job with CALCULATE and COUNTROWS, and it’s more flexible. In this tutorial, I’ll show you how to do COUNTIF in Power BI for every common case, including COUNTIFS with several conditions, and the one behavior that catches Excel users out.

Quick answer: Create a measure with CALCULATE(COUNTROWS(Table), condition), for example Large Orders = CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 10). For COUNTIFS, add more conditions separated by commas. For unique values, use DISTINCTCOUNT instead of COUNTROWS. To count items where a measure meets a condition, use COUNTROWS(FILTER(VALUES(Table[Column]), [Measure] > X)).

COUNTIF in Excel vs Power BI

In Excel, COUNTIF looks at a range and a criterion. In Power BI, you count rows of a table with COUNTROWS and pass the criterion as a filter to CALCULATE. Because it’s a measure, the result responds to slicers, filters and the rows of each visual. For the full set of counting functions, see the DAX count functions in Power BI.

ExcelPower BI DAX measure
=COUNTIF(B:B, “West”)CALCULATE(COUNTROWS(Sales), Sales[Region] = "West")
=COUNTIF(C:C, “>10”)CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 10)
=COUNTIF(D:D, “*Chair*”)CALCULATE(COUNTROWS(Sales), CONTAINSSTRING(Sales[Product], "Chair"))
=COUNTIFS(C:C, “>10”, E:E, “>0”)CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 10, Sales[Discount] > 0)
=COUNTA(F:F)COUNTA(Sales[Ship Date]) or COUNT
=COUNTBLANK(F:F)COUNTBLANK(Sales[Ship Date])

The examples below use a SalesData table with 400 orders from 2026: Order ID, Order Date, Region, Sales Rep, Product, Quantity, Unit Price and Discount. Create each measure with Home > New measure, then add it to a table visual with Region.

Count if equals a value

Orders = COUNTROWS ( SalesData )

West Orders =
CALCULATE ( COUNTROWS ( SalesData ), SalesData[Region] = "West" )

COUNTROWS counts the rows of the table in the current filter context. CALCULATE adds the condition. On a card, West Orders shows 109.

COUNTROWS counts rows, so it’s the right choice for “how many orders”. If you need to count the values in a column instead, COUNT and COUNTA skip blanks. To count text matches with OR, write SalesData[Region] IN { "West", "East" } in the condition. More options for filtering inside a measure are in how to filter a Power BI measure.

Count if greater than or less than a number

Large Orders =
CALCULATE ( COUNTROWS ( SalesData ), SalesData[Quantity] > 10 )

This counts the orders with more than 10 units: 169 of the 400. Use >=, <, <= or <> the same way. “Count if greater than 0” is the same pattern with > 0, and it’s one of the most common versions people search for.

COUNTIFS: count with multiple conditions

For several conditions that must all be true, add them as separate arguments to CALCULATE. They’re combined with AND:

Discounted Large Orders =
CALCULATE (
    COUNTROWS ( SalesData ),
    SalesData[Quantity] > 10,
    SalesData[Discount] > 0
)
Power BI formula bar with Discounted Large Orders = CALCULATE(COUNTROWS(SalesData), SalesData[Quantity] > 10, SalesData[Discount] > 0) and a table of count measures by Region

In my data, 81 orders are both large and discounted. The table above shows all the measures from this tutorial side by side, split by region.

For OR logic across two different columns, use FILTER, because each CALCULATE argument works on its own column:

Large Or Discounted =
COUNTROWS (
    FILTER ( SalesData, SalesData[Quantity] > 10 || SalesData[Discount] > 0 )
)

Count if contains text

Chair Orders =
CALCULATE ( COUNTROWS ( SalesData ), CONTAINSSTRING ( SalesData[Product], "Chair" ) )

CONTAINSSTRING isn’t case-sensitive, so “chair” also matches. In my data, 41 orders are for Office Chairs. For “starts with”, use LEFT(SalesData[Product], 6) = "Office" inside FILTER.

Count if between two dates

Q2 Orders =
CALCULATE (
    COUNTROWS ( SalesData ),
    SalesData[Order Date] >= DATE ( 2026, 4, 1 )
        && SalesData[Order Date] <= DATE ( 2026, 6, 30 )
)

That’s 147 orders between April 1 and June 30, 2026. Both conditions use the same column, so they can sit in one argument joined with &&. If you’d rather let users pick the dates, put a date range slicer on the page and use a plain COUNTROWS measure.

Count if blank or not blank

Unshipped Orders = COUNTBLANK ( Orders[Ship Date] )

Shipped Orders = COUNTA ( Orders[Ship Date] )

Unshipped (CALCULATE) =
CALCULATE ( COUNTROWS ( Orders ), ISBLANK ( Orders[Ship Date] ) )

COUNTBLANK and COUNTA are the direct equivalents of the Excel functions. The CALCULATE version is useful when you want to combine “is blank” with other conditions.

Count distinct values with a condition

To count unique values, such as how many sales reps gave a discount of 15% or more, swap COUNTROWS for DISTINCTCOUNT:

Reps With Big Discounts =
CALCULATE ( DISTINCTCOUNT ( SalesData[Sales Rep] ), SalesData[Discount] >= 0.15 )

Each region has one rep in my data, so each region row shows 1 and the total shows 4. The total isn’t the sum of the rows; it’s the number of distinct reps overall, which is exactly what distinct counts should do.

Count if a measure meets a condition

Sometimes the condition is a measure, not a column, for example “how many products sold more than $50,000”. CALCULATE can’t filter on a measure directly, so iterate over the products with FILTER:

Products Over 50K =
COUNTROWS (
    FILTER ( VALUES ( SalesData[Product] ), [Revenue] > 50000 )
)

VALUES lists the products visible in the current context, and FILTER keeps those whose Revenue is over $50,000. Overall, 4 products qualify. Within a single region, only Laptop does, and in Central none do, so that cell is blank. Add + 0 to the end of the measure to show 0 instead. The Revenue measure itself is explained in SUM vs SUMX in Power BI.

Why your COUNTIF shows the same number on every row

Here’s the behavior that confuses Excel users most. Put West Orders in a table by Region and every row shows 109, even Central and East. CALCULATE replaces the existing filter on Region with its own condition, so the row’s region is ignored.

If you want the count to respect the row and only add the condition on top, wrap the condition in KEEPFILTERS:

West Orders KEEPFILTERS =
CALCULATE ( COUNTROWS ( SalesData ), KEEPFILTERS ( SalesData[Region] = "West" ) )
Power BI table by Region: West Orders shows 109 on every row, while West Orders KEEPFILTERS shows 109 only on the West row and blank for Central, East and South

Neither is wrong. The plain version is what you want for a KPI card that always shows West. The KEEPFILTERS version is what you want in a table or chart split by region. A condition on a different column, such as Quantity > 10, doesn’t have this issue, because it doesn’t conflict with the Region rows.

COUNTIF as a calculated column or a measure?

You can also add a flag column, such as Is Large = IF(SalesData[Quantity] > 10, 1, 0), and sum it. It works, but it stores a value for every row and can’t react to anything chosen at view time. I use a measure unless I need the flag to slice or filter by. The IF pattern itself is covered in how to use IF in a Power BI measure.

To show a count as a share of all orders, divide two count measures with DIVIDE, as shown in how to divide in a Power BI measure.

Common COUNTIF problems

  • An error that a function was used in a True/False expression used as a table filter: a CALCULATE condition refers to a measure. Use FILTER over VALUES, as in the measure example above.
  • The count is blank instead of 0: add + 0 to the measure, or wrap it in COALESCE(…, 0).
  • Every row shows the same count: the condition is on the same column as the visual’s rows. Use KEEPFILTERS.
  • The total doesn’t equal the sum of the rows: expected for distinct counts and for measure-based conditions, because the total is calculated on all the data.
  • Text conditions miss values: check for trailing spaces and spelling variants in the data. A slicer is a quick way to see the exact values.

These DAX measure tutorials go well with COUNTIF:

Frequently Asked Questions

Is there a COUNTIF function in Power BI?

No. Use CALCULATE with COUNTROWS, for example CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 10). See Microsoft’s COUNTROWS reference for the counting function itself.

How do I do COUNTIFS with multiple conditions in Power BI?

Add each condition as another argument to CALCULATE: CALCULATE(COUNTROWS(Sales), Sales[Quantity] > 10, Sales[Discount] > 0). The conditions are combined with AND.

How do I count if greater than 0 in Power BI?

Use CALCULATE(COUNTROWS(Table), Table[Column] > 0). Replace COUNTROWS with DISTINCTCOUNT to count unique values instead.

Why does my COUNTIF measure show the same value on every row?

CALCULATE replaces the filter on the column you’re testing. Wrap the condition in KEEPFILTERS so the row’s own filter is kept.

How do I count rows where a measure is above a value?

Use COUNTROWS(FILTER(VALUES(Table[Column]), [Measure] > value)). CALCULATE conditions can’t reference measures directly.