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
dim123dim123
Helper I
Helper I

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 7
Wilson_
Solution Sage
Solution Sage

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?)

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 ? 

 

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?)

but dividing by 0 should give an error always ? But no,

divide(blank()/0,1)  and  return Blank 

divide(blank(),blank(),1) Return blank

and 

divide(1,blank(),1) return 1 

This is not mathematically and logicaly right 

You can either work within the constraints of how Power BI actually works or just insist that it doesn't work the way your intuition says it should work. I don't know what to tell you. How division works with blanks overrides how division works with zeroes.

 

You do not have the ability to actually change how Power BI works to fit your intuitions better. (After all, you cannot actually have blanks in mathematics in the first place, right?)

There's no point in arguing.
If it is necessary to get a value other than BLANK as a result of division -
function is not suitable.


If a formula or procedure works incorrectly, it is usually fixed by the developers.

The recommendations to always use DIVIDE instead of IF is not 100% correct

So the performance is lost 😞 unfortunately

 

In addition, if divide(blank()/0,1) and divide(0/blank(),1) had given the same result, I would even agree with you, but unfortunately the results are different . Right ? 

 

I disagree with you that it works incorrectly, but I agree with you that "arguing" would be a waste of time so have a great day! 😄

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