Forum Discussion

dim123dim123's avatar
dim123dim123
Helper I
3 years ago

DIVIDE error ?

HI 

who can explain me 


DIVIDE(blank(),0,5) - return BLANK
DIVIDE(0,blank(),5) - return 5

 

if (ISERROR( blank()/0),1,2) - Return 2 NOT ERROR
if (ISERROR( 0/blank()),1,2) - Return 1 ERROR

 

Why blank()/0 is not error ? and why is divide return BLANK ? 

7 Replies

  • Wilson_'s avatar
    Wilson_
    Memorable Member

    Straight from Microsoft's documentation: "Performs division and returns alternate result or BLANK() on division by 0."


    ----------------------------------
    If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

    • dim123dim123's avatar
      dim123dim123
      Helper I

      if (ISERROR( blank()/0),1,2) - Return 2 NOT ERROR
      if (ISERROR( 0/blank()),1,2) - Return 1 ERROR

       

      How it possible to device Blank()/0 and not got error ? 🙂 
      Some kind new mathematics logic?

      And DIVIDE(blank(),0,5)  

       

      i think all cases  

      1) x/0 

      2) blank/0 

      3) blank /X 

      4) X/blank

      5)0/blank

      6)blank/blank

      Must return error and alternateresult ? or what ? 

       

      • Wilson_'s avatar
        Wilson_
        Memorable Member

        BLANK() and 0 are not quite the same thing. They are functionally the same in a lot of cases, but not always. However, it sounds like you want the DIVIDE function to treat BLANK() like a 0. In that case, wrap whatever is returning you a BLANK() in a COALESCE function:

        COALESCE ( [measure returning blank], 0 )

         


        ----------------------------------
        If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)