Skip to main content

Power BI

Needs Votes

Change Zero to Blank Function

Vote (4) Share
Luke Walker's profile image

Luke Walker on 11 Aug 2018 00:21:42

Often in reports, it is convenient and simplifies content to display zeroes as blanks. Current the DAX VAR Print = 'code here' RETURN IF(Print=0,BLANK () ,Print). This could be simplified by a function ZEROTOBLANK () or similar to replace this.

Comments (2)
Luke Walker's profile image Profile Picture

Kenneth Barber on 06 Jul 2020 00:01:12

RE: Change Zero to Blank Function

If you want slightly shorter code in the meantime to convert zeros to blanks, you can use:
DIVIDE(1,DIVIDE(1,'code here'))
Of course, this code is probably slower than yours and is not as clear.

To convert blanks to zeros, use this:
'code here'+0
Instead of having a special BLANKTOZERO function, I feel that it is best to introduce IFBLANK and use 0 as the 2nd argument:
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/32049442-add-function-ifblank-value-alternate

Luke Walker's profile image Profile Picture

Arun Mallick on 05 Jul 2020 23:39:52

RE: Change Zero to Blank Function

this is a nice feature to have. I would recommend to have both options, 1) show all zeros to blanks 2) all blanks as zeros. Also, would be super useful to provide this option in the Format blade.