Forum Discussion

Boja's avatar
Boja
Advocate II
8 years ago
Solved

handling blanks - problem

Hello,

I am trying to assign number of image depending on the value of the nps score. If version is unstable, no nps value is calculated and grey image (num 1) should be assigned. However, DAX calculates blank as infinity so i am having weird (1+4) outcome for the image num.

 

 

Color20 = SUMX( VALUES('Circle tbl'[Circle]) , 
SWITCH( 'Circle tbl'[Circle], 
"green", IF( [nps st/nonst] > 20 , 4, 0 ),
"red", IF( [nps st/nonst] <= 10 , 2, 0 ),
"orange", IF( AND( [nps st/nonst] > 10, [nps st/nonst] <= 20 ), 3, 0),
"grey", IF( [nps st/nonst] = "--" , 1 , 0 ),
0
))

 

  • Hi Boja, 

     

    At the end of your SUMX, add '+0', to turn all blanks into zero values.

     

    Hope that helps! 

1 Reply

  • JoHo_BI's avatar
    JoHo_BI
    Responsive Resident

    Hi Boja, 

     

    At the end of your SUMX, add '+0', to turn all blanks into zero values.

     

    Hope that helps!