Click here to Skip to main content
15,888,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to calculate sales growth percentage for 2 financial years(product wise)
But for some of the products its showing null value.

eg.
fy_1617 / fy_1516 / sales growth
0 / 0 / 100
1514561 / 0 / #error
0 / 2156465 / 100

If the fy_1516 value is '0' then the sales growth is showing as 'error' and if both the values are '0' it is showing as 100.

What I have tried:

Code :-

Public Function Divider (ByVal Dividend , ByVal Divisor )

If IsNothing(Divisor ) Or Divisor = 0 Then
Return 0

Else
Return Dividend/Divisor
End If
End Function

Expression :-

IIF (Fields!INVSUM.Value>=0,((Code.Divider(Fields!INVSUM.Value,Fields!INVPrevYear.Value)-1)*100),(((Fields!INVSUM.Value-Fields!INVPrevYear.Value)/Fields!INVPrevYear.Value)*100))
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900