Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am new to power bi and am having trouble with the basics like Countrows. I am getting blank as the total amount of rows, but I do not have 0 rows i have thousands. After reseraching this error Countrows should only show as blank if there are no rows. If it helps my measure is "Meaure 5 = Countrows(Table)" and is format as "whole number"
Is this error occuring because of a format or what could potentially be causing this error. Any help is much appreciated.
Hi @lovekheart,
Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @mark_endicott & @DataNinja777 for sharing valuable insights.
Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.
Thank you.
@lovekheart - if your aim is to show a count of the rows in a table regardless of any filters that are applied to the table, you can use the following:
COUNTROWS( ALL('Table' ))
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
Please can you provide the pbix for inspection? Without information on the filter context in which the formula is evaulated, it is impossible to help you.
Thanks
Hi @lovekheart ,
It's a common experience for those new to Power BI to encounter a blank result from a COUNTROWS measure when expecting a large number. The issue is almost certainly not with the measure's format but rather with the "filter context" in which it is being evaluated. Your DAX measure, Meaure 5 = Countrows(Table), is correct, but Power BI calculates it based on the active filters from slicers, other visuals, or the Filters pane. If these combined filters result in no rows from your table being visible in the current view, COUNTROWS will correctly evaluate over an empty set of rows. This behavior is also heavily influenced by the relationships between your tables; an active filter on a related table can propagate and leave no rows to be counted in your target table. It is a fundamental concept in DAX that when an aggregation function like COUNTROWS operates on an empty table, it returns a BLANK() value, not zero. This is by design to avoid cluttering visuals with zeros for combinations that have no data. If you have investigated your filters and relationships and determined that a zero is the desired output in these situations, you can modify your measure to explicitly handle the blank case. The simplest method is to add zero to your expression, which coerces the blank result into a number.
Measure 5 = COUNTROWS('Table') + 0
A more explicit approach is to use the COALESCE function, which returns the first non-blank argument. You provide your original measure as the first argument and zero as the fallback.
Measure 5 = COALESCE(COUNTROWS('Table'), 0)
Alternatively, you can achieve the same result with an IF statement that checks if the result is blank using ISBLANK and returns zero if it is, otherwise returning the actual count.
Measure 5 = IF(ISBLANK(COUNTROWS('Table')), 0, COUNTROWS('Table'))
While these solutions will display a zero, it is crucial to first investigate the filter context and relationships to understand why you are getting a blank value, as simply converting it to a zero might hide an underlying issue in your data model or report design.
Best regards,
User | Count |
---|---|
15 | |
13 | |
12 | |
10 | |
10 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |