Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How do I avoid to count the empty value?

Hi,

 

I want to count how many types in the table below:

 

Name

Type
A1
B2
C2
D1
E 

 

I used the code following: 

Type(#) = IF(ISBLANK(DistinctCount(Sheet1[Type])),0,DISTINCTCOUNT(Sheet1[Type]))
 
The result returned is 3, apprently, it also counts the blank/empty space as a new type.
 
I am wondering how should I avoid count the blank and got the result is 2?
 
Thanks!
  • Hi, Anonymous 

     

    There is a function called DISTINCTCOUNTNOBLANK which avoid count blank value.

     

    So to count of Type, just write a measure DISTINCTCOUNTNOBLANK( Table[Type] )

     

    Hope it will work for you.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you!

2 Replies

  • ddpl's avatar
    ddpl
    Solution Sage

    Hi, Anonymous 

     

    There is a function called DISTINCTCOUNTNOBLANK which avoid count blank value.

     

    So to count of Type, just write a measure DISTINCTCOUNTNOBLANK( Table[Type] )

     

    Hope it will work for you.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you!