Forum Discussion

LogiFons's avatar
LogiFons
Frequent Visitor
2 years ago
Solved

SUMX functions with ISBLANK?

Good evening all,

 

I am trying to learn DAX, but have now an easy problem wherefor i can't fond the solution.

 

I made below measure for a card visual.

 

Measure punten =
sumx(
    DISTINCT(
        tblDataInput[RitNr]),
        [Telling NCR Punten]
            )
 
This works fine, but the outcome is sometimes "(blank)".
Which code do i need to change the text blank to the number 0 (zero)?
 
Do i need to add "ISBLANK" and where?
I thought before [Telling NCR Punten].
But this is not the solution.
 
Can someone help me to the wright direction?
 
Thank you.
 
Gr,
 
 
  • hi LogiFons 

     

    you can wrap the expression with the coalesce function, e.g :

    Some Total = Coalesce( SUMX( SomeTable,SomeTable[SomeColumn] ), 0 )
    or you can add a 0 to the expression e.g :
    Sum Total = SUMX( SomeTable,SomeTable[SomeColumn] ) + 0
     so with a condition it would look lie :
    Some Total 2 = Coalesce( SUMX( FILTER( SomeTable, SomeTable[AnotherColumn] = "2" ), SomeTable[SomeColumn]), 0 )
     

2 Replies

  • hi LogiFons 

     

    you can wrap the expression with the coalesce function, e.g :

    Some Total = Coalesce( SUMX( SomeTable,SomeTable[SomeColumn] ), 0 )
    or you can add a 0 to the expression e.g :
    Sum Total = SUMX( SomeTable,SomeTable[SomeColumn] ) + 0
     so with a condition it would look lie :
    Some Total 2 = Coalesce( SUMX( FILTER( SomeTable, SomeTable[AnotherColumn] = "2" ), SomeTable[SomeColumn]), 0 )
     
    • alfonskannegiet's avatar
      alfonskannegiet
      Regular Visitor

      Hi Rubinboer,

       

      Thank you for your fast response.

      I had already tried to add the +0.

       

      But i added this before the ).

      This doesn't wordt.

       

      The +0 after the ) does work!

       

      Thank you for this solution!

       

      Enjoy your evening.