Forum Discussion

EvelynBI's avatar
EvelynBI
Frequent Visitor
5 years ago
Solved

Default filtering table with null and zero values: when click "0" it lists all 0's AND null items

How to replicate: This was tested on Version: 2.88.1144.0 64-bit (December 2020) New Power BI desktop report Enter data:   0   1   0   1 edit: After entering the ...
  • PhilipTreacy's avatar
    PhilipTreacy
    5 years ago

    Hi EvelynBI 

    Ah, OK.  When I entered the data I don't think it did the auto type conversion. Can't quite remember.

    The behaviour you are seeing is that Blank is being treated as 0, you can read more on this here

    Handling BLANK in DAX - SQLBI

    I created a measure to check for the count of zeroes in the table

     

    ZeroCount = CALCULATE(COUNTROWS('Table'), FILTER('Table','Table'[Column1]=0))

     

    and the result is 6

    But if you count the number of blanks

     

    BlankCount = CALCULATE(COUNTROWS('Table'), FILTER('Table',ISBLANK('Table'[Column1])))

     

    the result is 4

     

    When you filter for the value 0, the Blanks are cast/treated as 0 so you see all rows in the table that are either 0 or Blank.

    When you filter for Blank, you only see Blank.  0 isn't treated as Blank.

    And of course when you filter for 1 you only see 1's.

    Also, if you convert the values column containing the blanks/1/0 to True/False, Blank and 0 are cast to False and 1 to True.

    Download my PBIX if you want to see the measures.

    Regards

    Phil