Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Calculating GP%

Posted on by 47

I'm calculating the gross profit (Gross Profit / Sales Amount) percentage in SRSS report where there is a line that have Sales Amount = 0 (Discount 100%). this leads to an Error output. 

I have used if statement in the expression  

=IIf(Sum(Fields!SalesAmountActual.Value) >  0 , (Sum(Fields!Gross_Profit.Value) / Sum(Fields!SalesAmountActual.Value)) , 0)

the Output

 pastedimage1677486097965v2.png

  • Suggested answer
    Ziyad Najami Profile Picture
    Ziyad Najami 47 on at
    RE: Calculating GP%

    Solve it this way

    The Expression

    =Code.GetGP(Sum(Fields!SalesAmountActual.Value), Sum(Fields!Gross_Profit.Value))

    The Code:

    Public Function GetGP(ByVal SalesAmount As Decimal,ByVal GrossP As Decimal)

        if SalesAmount = 0 then

    Return 0

         end if

       Return (GrossP /SalesAmount)

      End Function

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans