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

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

RE: Count should return 0 instead of (Blank)

Important as alternative would be to use IsBlank which would mean performing the COUNT twice.

Stephane Viot's profile image Profile Picture

a33aaa92 29ff-4b94-a178-8eedb6c46ecb on 05 Jul 2020 22:42:16

RE: Count should return 0 instead of (Blank)

Adding a 0 is fine, but it's not always a solution. Not in all cases. I agree with David Cadman, an option to choose how to display (Blank). Sometimes 0 is alright, something plain text saying "None". Anything but (Blank).

Stephane Viot's profile image Profile Picture

bbbda08e cb79-4031-b140-771ce46481d1 on 05 Jul 2020 22:40:31

RE: Count should return 0 instead of (Blank)

Adding + 0 to your formula should take care of the blank

Stephane Viot's profile image Profile Picture

dc352e0f e51e-4c5b-8cfb-47d0b9d0e634 on 05 Jul 2020 22:40:29

RE: Count should return 0 instead of (Blank)

It makes sense that Blank is returned by formulas sometimes, but on say the Card visual it would make sense to have the option "Display (Blank) as 0" Y/N

Stephane Viot's profile image Profile Picture

bb610fa5 245e-4b51-89cf-559ff6a686b0 on 05 Jul 2020 22:39:17

RE: Count should return 0 instead of (Blank)

DAX returning blank makes sense because of what it means in the context of charts. If there is no data for a particular dimension, then generally we do not want it to draw a line or a bar. However, in the case of cards, I believe the default behavior would be best if it showed zero instead of (Blank). Given that (Blank) is the established behavior, I would ask that a formatting option be created for card and multi-card to show 0 instead of blank.

Stephane Viot's profile image Profile Picture

381ed531 e55a-4f9d-b59b-ef5cd57d18be on 05 Jul 2020 22:38:49

RE: Count should return 0 instead of (Blank)

Adding a zero on the measure worked, great workaround.

Stephane Viot's profile image Profile Picture

4b18f135 673f-48dc-ab97-d21ae4e8c739 on 05 Jul 2020 22:37:37

RE: Count should return 0 instead of (Blank)

Quick work around if anyone is interested. Adding a zero forces Power BI to display Zero!

CALCULATE(COUNTROWS(table),table[column]) + 0

Stephane Viot's profile image Profile Picture

94c16575 d9c7-4e5c-857e-151e0c2668de on 05 Jul 2020 22:36:37

RE: Count should return 0 instead of (Blank)

I agree having the zero makes the visuals look more elegant. Blank is go to know there is an error, but that doesn't make sense for a visual.

Stephane Viot's profile image Profile Picture

c78ac634 2c23-e711-816c-e0071b6ac181 on 05 Jul 2020 22:33:34

RE: Count should return 0 instead of (Blank)

That could be a option by Element. Some visuals don't need this option and additionnal Zero could be just noise but on some visuals, turning on this option could be a great way to get niciest results.

Stephane Viot's profile image Profile Picture

8b208ea0 a314-4f6f-bcbc-171743f585a0 on 05 Jul 2020 22:28:55

RE: Count should return 0 instead of (Blank)

Yep adding 0 at the end of the measure worked @craig