If I understand correctly you need something like
deltapercent= mypercentfunction(0ldvalue,newvalue, abval )
you also need business rules, is an increase in a debt to be reported as an increase, or a decrease? so a third parameter, abval can be passed
FUNCTION mypercentfunction
lparameter Oldvalue, newvalue, abval
IF oldvalue = newvalue
return 0
endif
IF oldval=0 .and. abval
return 100
endif
IF oldval = 0 .and abval < 0
return -100
endif
IF abval
delta=(abs(oldval)*100 - abs(newval))*100 )/abs(oldval
* multiply by 100 first to increase accuracy of rounding !
return delta
endif
you probably need to add soem more conditions , too !
not an easy task, given how math challenged most clients are !
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only