cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Route11 Member
Member

Show blank cells as zeros using Sum formula in dax

Hi Experts

 

how would you convert the following sum formula to show '0' in empty/blank cells as opposed to blank...

 

OHASum = SUM(OHA_[Total])

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Show blank cells as zeros using Sum formula in dax

well normally blanks wouldn't appear at all unless there is value in other measures
so maybe a conditional such us this would solve it:

OHASum =
VAR OHA =
SUM ( OHA_[Total] )
RETURN
IF (
ISBLANK ( OHA )
&& ( [OtherMeasure1] <> 0
|| [OtherMeasure2] <> 0 ),
0,
OHA
)

 

 

7 REPLIES 7
SjoerdV Frequent Visitor
Frequent Visitor

Re: Show blank cells as zeros using Sum formula in dax

Could you try OHASum = IF(HASONEVALUE(SUM(OHA_[Total]));0)?

Route11 Member
Member

Re: Show blank cells as zeros using Sum formula in dax

getting the following errorCapture.PNG

SjoerdV Frequent Visitor
Frequent Visitor

Re: Show blank cells as zeros using Sum formula in dax

My bad, the if-formula is not complete.

 

OHASum = IF(HASONEVALUE(SUM(OHA_[Total]);SUM(OHA_[Total]);0)

 

 

Super User
Super User

Re: Show blank cells as zeros using Sum formula in dax

this will work

OHASum = SUM(OHA_[Total])+0

the issue may be that you will see more items that you would normally like

Route11 Member
Member

Re: Show blank cells as zeros using Sum formula in dax

Hi Stachu

 

Apologies but no working that data set in the table increase to show unwanted elements.....still not getting the desireed result

Route11 Member
Member

Re: Show blank cells as zeros using Sum formula in dax

i have chnaged the ; to , and still getting error to many values passed to the HASONEVALUE function

Highlighted
Super User
Super User

Re: Show blank cells as zeros using Sum formula in dax

well normally blanks wouldn't appear at all unless there is value in other measures
so maybe a conditional such us this would solve it:

OHASum =
VAR OHA =
SUM ( OHA_[Total] )
RETURN
IF (
ISBLANK ( OHA )
&& ( [OtherMeasure1] <> 0
|| [OtherMeasure2] <> 0 ),
0,
OHA
)