Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
Stachu
Community Champion
Community Champion

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
)

 

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

8 REPLIES 8
SjoerdV
Frequent Visitor

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

Anonymous
Not applicable

getting the following errorCapture.PNG

Stachu
Community Champion
Community Champion

this will work

OHASum = SUM(OHA_[Total])+0

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



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

This displays the 0 value for that particular column using the measure. However, a secondary calculated column that is attempting to subtract that measure from another, still shows a blank value. It doesn't seem to recognize the zero value.

Anonymous
Not applicable

Hi Stachu

 

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

My bad, the if-formula is not complete.

 

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

 

 

Anonymous
Not applicable

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

Stachu
Community Champion
Community Champion

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
)

 

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors