Here’s a common question in data analysis (details vary per industry), which i’ll answer in this tutorial: “I have a large HR dataset in Power BI, and need to create a simple dashboard showing to count the total number of employees as well as employees meeting some specific criteria. How can I create measures to count rows with and without conditions?”
For this tutorial, we’ll assume a single table named “Employees”. The table contains several fields: EmployeeID (whole number), Name (text), Department (text), Salary (decimal number), and HireDate (date).
Counting All Rows
To count all rows in the table, create a measure using the COUNTROWS function:
Total Employees = COUNTROWS(Employees)
This measure will return the total number of rows in the Employees table, representing your total workforce.
Counting Rows with a Condition
To count rows that meet specific criteria, use the CALCULATE function along with COUNTROWS:
IT Employees = CALCULATE(COUNTROWS(Employees), Employees[Department] = "IT")
This measure counts employees in the IT department. You can modify the condition to suit your needs:
High Earners = CALCULATE(COUNTROWS(Employees), Employees[Salary] > 75000)

Count with Multiple Conditions
For more complex scenarios, combine multiple conditions:
Senior IT Staff =
CALCULATE(
COUNTROWS(Employees),
Employees[Department] = "IT",
Employees[Salary] > 75000,
Employees[HireDate] < DATE(2020, 1, 1)
)
This measure counts IT employees with high salaries who were hired before 2020.
Dynamic Conditions
For flexible analysis, create parameters that users can adjust:
- Create a “Salary Threshold” parameter using a What-if parameter.
- Create a measure for dynamic high earners:
Dynamic High Earners =
CALCULATE(
COUNTROWS(Employees),
Employees[Salary] > [Salary Threshold]
)
Note: Feel free to adjust the salary threshold interactively.
Real world implementation idea
- Create a card visual to display “Total Employees”.
- Add a multi-row card to show various employee counts.
- Create a slicer for the “Department” field to enable filtering.
- Add a line chart showing employee counts over time using HireDate.

Choose a counting pattern that matches filter context
Treat this task as a small diagnostic decision so each result identifies the next useful action. Validate the measure against a small table whose expected result is known. Write down the account, client or device, and exact symptom so that later tests use the same conditions. Change one variable at a time; several simultaneous fixes can hide the real cause and make the problem return.
Protect the current state
Compare calculated columns with measures before choosing an implementation. Repeat the test with a simple sample that contains no confidential or business-critical data. If the sample works, compare permissions, file location, policy, and content with the failing case instead of reinstalling the whole product.
Test slicers and relationships because context can change the result. Keep the original configuration or data until the new result has been checked. When a setting is unavailable, grayed out, or labeled as organization-managed, capture that message and ask the responsible administrator to review the policy.
Know when the issue needs an administrator
undefined. Confirm the result after closing and reopening the relevant app, then repeat it from the normal user workflow rather than only from an administrator or owner account. A successful one-time test is not enough when synchronization, scheduled refresh, or another device is involved.
If behavior differs across clients, record the app version, account type, time of the test, and where the expected result appears. Use that evidence to decide whether the remaining fault is local, account-specific, data-specific, or service-side. This keeps troubleshooting narrow and protects working settings while support investigates the correct layer.
Finally, explain the intended outcome to another user and have that person repeat the shortest safe test. Their result can reveal hidden owner privileges, cached state, or assumptions about where data is stored. Preserve screenshots of error messages only after removing names, addresses, document content, and other private information.
Count rows in Power BI do not work
Common issues when counting rows include:
- Blank results: Ensure your table has data and check for typos in table/column names.
- Incorrect counts: Verify your data model for unwanted relationships or duplicates.
- Slow performance: For large datasets, consider using calculated columns instead of measures for static counts.
- Inconsistent results: Check for proper date formatting and data type consistency.