You need to sign in to do that
Don't have an account?
MaheemSam
Math Operation is returning a wrong result
Hi,
I am using a below formula Here Resller Discount = 25% and Margin = 7%
I am using the same formula in salesforce Apex but Disti Discount is returning as 25% it self Please suggest me what might be the mistake in this math opeation I am doing
Thanks
Sudhir
I am using a below formula Here Resller Discount = 25% and Margin = 7%
Disti discount% = Margin% * (1-Reseller dicount%) + Reseller discount%If I use above formula in excel it is giving Disti Discount= 30.35%
I am using the same formula in salesforce Apex but Disti Discount is returning as 25% it self Please suggest me what might be the mistake in this math opeation I am doing
public PageReference addDistiDisc() { Decimal Margin = 7/100; Decimal Ddisc; Decimal Rdisc; for(QuoteLineWrapper qw : lines) { Rdisc = Decimal.Valueof(qw.qline.Reseller_Discount__c)/100; Ddisc = Margin * (1 - Rdisc ) + Rdisc ; qw.qline.Disti_Discount__c = String.Valueof( (Ddisc) * 100); updateTotal(qw); qw.isChanged = true; } return null; }
Thanks
Sudhir
Thanks
let me inform if it helps you
All Answers
I tried your formula it is giving different result 31.75 I am using below formula which is returning Disti Discount Margin = 46.23% and Reseller Discount Margin = 50%
In apex it is returning as -143 which is different Please suggest.
Thanks
Sudhir
When I enter 25 for Ddisc RMargin should come as 19.35 instead it is returning -3 Please suggest
Thanks
Sudhir
Thanks
let me inform if it helps you