Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Cymbolz
Helper III
Helper III

COUNT function includes cells with text

Hello,

 

I am puzzled by the behavior of the DAX function COUNT.

 

Am expecting it to behave like Excel's count() function, in that it returns the count of cells with numbers but not text. 

 

The Reference Documentation indicates this too, "The COUNT function counts the number of cells in a column that contain numbers."

 

I see further info stating "If the row contains text that cannot be translated into a number, the row is not counted."

 

I've tested in Excel using both Power Pivot and DAX Studio, and in PBI Desktop.  In all cases, a column of type text with only text values (that couldn't possible be translated to a number) is returning a count equal to the number of rows / cells.  I expect zero as a result.  Am I missing something obvious, or has the behaviour changed / always been like this just not properly documented?

 

Eg measure:  Count Name:=COUNT('Table'[name])

1 ACCEPTED SOLUTION

Hi @Cymbolz,

 

I have reported this issue to the Product Team to investigate more. I will update here later.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

I can confirm your results. I also believe that the behavior has changed as it used to not count text and you had to use COUNTA as I recall.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler, glad it wasn't just me seeing this.

 

Would appreciate if a few others can confirm the same.

 

Thus, it would seem MS have changed the behaviour but not any documentation.  Wonder how many people wrote code relying on the previous functionality???  And maybe not even realise it's changed.

Hi @Cymbolz,

 

I have reported this issue to the Product Team to investigate more. I will update here later.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, 

 

The report ID is: 61341249.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Cymbolz,

 

The document will be updated.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.