Forum Discussion

elcojo2's avatar
elcojo2
Frequent Visitor
6 years ago
Solved

Divide by 0 formula

I am new to power bi, just create a simple table I have not been able to determine why in some cases Job profit %  -Gross shows =  0.00% percent when Line income Paid Amount AE is = 0 but other times give me a strange negative number like in this example attached.

 

 
 
  • Hi elcojo2 ,

    According to your formula, its calculation logic is to divide the value of each row.

    For example:

    62.55% = 542.02/866.47

    0.00% = 89.24/0.00

     

    I'm not sure what proportion you want to calculate

    Maybe you can try this measure:

    ( each value of [Job Profit -Gross]/ total of [Line Income Paid Amout AE] column )

     

     

    % = 
    DIVIDE(
        [Job Profit -Gross],
        CALCULATE(
            SUM([Line Income Paid Amout AE]),
            ALL( table )
            )
    )

     

     

     

    Best regards,
    Lionel Chen

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • check when [Line income Paid Amount AE] =0, especially in the subtotal case. Increase the number of decimal places and see if there is anything down the line.

    Forcefully do a rounding of the measure to 2 or three decimal places and check. You can do it in it formula if required.

     

  • v-lionel-msft's avatar
    v-lionel-msft
    Community Support

    Hi elcojo2 ,

    According to your formula, its calculation logic is to divide the value of each row.

    For example:

    62.55% = 542.02/866.47

    0.00% = 89.24/0.00

     

    I'm not sure what proportion you want to calculate

    Maybe you can try this measure:

    ( each value of [Job Profit -Gross]/ total of [Line Income Paid Amout AE] column )

     

     

    % = 
    DIVIDE(
        [Job Profit -Gross],
        CALCULATE(
            SUM([Line Income Paid Amout AE]),
            ALL( table )
            )
    )

     

     

     

    Best regards,
    Lionel Chen

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.