web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

Detailed Sales Report Profit Margin giving me a divide by zero error encountered

(0) ShareShare
ReportReport
Posted on by

Begin Column
FieldName = "ProfitMargin"
DrillDownFieldName = ""
DrillDownReportName = ""
Title = "ProfitMargin"
VBDataType = vbLong
Formula = "((TransactionEntry.Price - TransactionEntry.Cost) * TransactionEntry.Quantity)/(TransactionEntry.Price
* TransactionEntry.Quantity)" CASE WHEN ProfitMargin IS NULL THEN 0
ColHidden = False
ColNotDisplayable = False
FilterDisabled = False
ColWidth = 1920
GroupMethod = groupmethodNone
ColFormat = ""
End Column

I have added "CASE WHEN ProfitMargin IS NULL THEN 0" but I still get "Divide by zero error encountered" message. Can anyone help me with this?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Antonijo Todorovik Profile Picture
    4,025 on at
    RE: Detailed Sales Report Profit Margin giving me a divide by zero error encountered

    Hi Dr.RYU.

    Try changing FORMULA part with this next:

    Formula = "CASE WHEN TransactionEntry.Price * TransactionEntry.Quantity <> 0 THEN ((TransactionEntry.Price - TransactionEntry.Cost) * TransactionEntry.Quantity)/(TransactionEntry.Price * TransactionEntry.Quantity) ELSE 0 END"

    It works on my PC, have just test it.... Be careful, it have to be in whole line, otherwise RMS will not be able to read the report properly...

    Regards, A.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Detailed Sales Report Profit Margin giving me a divide by zero error encountered

    WORKS LIKE A CHARM! THANKS ANTONIJO!!!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics RMS (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans