Skip to main content

Power BI

Needs Votes

Count should return 0 instead of (Blank)

Vote (552) Share
Stephane Viot's profile image

Stephane Viot on 07 Oct 2015 23:52:58

Count of should return 0 instead of '(Blank)' (looks better on a Dashboard)

Comments (51)
Stephane Viot's profile image Profile Picture

5bad4e9c 0531-4168-88c4-fcb410ff3ab6 on 05 Jul 2020 23:14:47

RE: Count should return 0 instead of (Blank)

I added a new column 'Zero' with 0 to one of my table. Then add a Quick Measures to my Field in the Card and select Addition for Calculation. Then add Base Value to the column 'Zero' to display 0 on the card if the Field is Blank.
Hope that helps!

Stephane Viot's profile image Profile Picture

be1c9a59 210b-4751-beb6-669ba0d6baab on 05 Jul 2020 23:13:08

RE: Count should return 0 instead of (Blank)

I agree. A lot of upper management and leadership people at my company want to see 0, instead of a blank. Checking a box in the "Matrix" display options would save hours of work writing up a DAX code.

Stephane Viot's profile image Profile Picture

3b994b3a 3db6-4f3a-addc-55830877d465 on 05 Jul 2020 23:08:52

RE: Count should return 0 instead of (Blank)

Sure, you could do this using a new DAX measure, but wouldn't it be better if the Card visuals simply have a checkbox in the visual properties to show either (Blank) or 0?

Stephane Viot's profile image Profile Picture

87e91654 fcb0-43f9-9581-08411d6279d7 on 05 Jul 2020 23:08:38

RE: Count should return 0 instead of (Blank)

Has anyone had this problem before related to this idea? This idea would solve my problem as the + 0 and ISBLANK () solutions do not work for me. If there is anyone that has had my problem before (see: https://community.powerbi.com/t5/Desktop/KPI-Visuals-and-Blank-Issue-with-making-Blank-a-0/m-p/331941#M148417), please let me know if you found a different solution!

Stephane Viot's profile image Profile Picture

1190f0ed a8db-46a2-883d-8d085e112812 on 05 Jul 2020 23:07:15

RE: Count should return 0 instead of (Blank)

Dax is working fine... blank is blank, not 0. And blank is displayed as blank in many visuals.
But the CARD VISUALISATION is not! it's the one that should be fixed, to either show a real blank or show at least a 0 (maybe with an option "show blank as 0" or something).

Stephane Viot's profile image Profile Picture

f9460a9f a38d-4368-b28f-af80c5491acb on 05 Jul 2020 23:07:02

RE: Count should return 0 instead of (Blank)

Card is meant to be a first-class visualization, but without this fix must resort to creating card-specific measures. The '+0' solution isn't an option because the same measure is being used in a chart with date axis, and with '+0' I get dates appearing with 0 values when these dates should not be appearing at all.

Stephane Viot's profile image Profile Picture

f9460a9f a38d-4368-b28f-af80c5491acb on 05 Jul 2020 23:07:02

RE: Count should return 0 instead of (Blank)

Putting more thought into it, I just needed to update my DAX with conditional logic which returned Blank () or 0 depending on the year in the evaluation context. So I don't need to write more measures. DAX is a lifesaver!

Stephane Viot's profile image Profile Picture

0d2c2d10 ae1e-48bd-93f3-87603f96c7db on 05 Jul 2020 23:06:08

RE: Count should return 0 instead of (Blank)

Creating a measure for every card is too excessive and limits functionality......

Stephane Viot's profile image Profile Picture

9a6813ed 4c32-43b1-b337-a6c845035fe7 on 05 Jul 2020 23:04:27

RE: Count should return 0 instead of (Blank)

Adding zero to the measure does not work well since it breaks formatting on other visuals such as charts.

Stephane Viot's profile image Profile Picture

72c57afc aca3-4a01-b878-a83dea2dd862 on 05 Jul 2020 23:00:13

RE: Count should return 0 instead of (Blank)

Also note ... The best way of handling nulls is by using a find replace in Power Query.
Where ever possible data transformations should be performed in Power Query.