Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Divide Numerator by Denominator - Row Level

Hi, would anyone be able to assist with the measure to divide the Yield(Numerator) by the Volume for each asset class? I've created 2 measures for each but when I divide to get to the yield, I'm gett...
  • ExcelMonke's avatar
    2 years ago

    I think the issue is that you can't divide by zero ... 🤠 
    Assuming your numerator and denominator values are "normal" (i.e. not a result of a complex measure), and in a number format, dividing the two should not kick back any errors. 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    Thanks for the reply from ScottShearer and ExcelMonke .

     

    Use the Divide function for division instead of “/”.

     

    I have the same problem as you when I use “/”.

     

    For more information about the Divide function see:

    DIVIDE function (DAX) - DAX | Microsoft Learn

     

    Can you try this Measure below:

    Measure = DIVIDE(MAX('Table'[Denominator]), MAX('Table'[Numerator]),0)

     

    I noticed in your screenshot that either the numerator is 0 or the denominator is 0 .

     

    0 divided by any number is 0, and in my Measure syntax I set it to return 0 if it divides by 0, so when I use the data in the screenshot, the result is all 0, so I added a row of non-0 data.

     

    The final page result is as follows:

     

    The pbix file is attached.

     

    If you have any other questions please feel free to contact me.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!