Calculate Discount Amount

  • Thread starter Thread starter Lirva Smith via AccessMonster.com
  • Start date Start date
L

Lirva Smith via AccessMonster.com

I am working with the following fields in my query:

1. Total
2. Discount
3. TotalDisc

I am trying to calculate the total discount but for some reason it's not
correct.

I tried: Total - Discount - Total (eg: $100 - 25% - $100 = - $25)
so the discount is $25, it doesn't work out in my query but it works when I
use a calculator.

Can someone help me with this math. Thanks!
 
Try something like:
Total - (Total * Discount)
If it works with your calculator I expect you are using a number like 100 or
not use the calculation precedence used in programming languages.
 
It seems to work with this:

Total - (Total - Discount)


Thank you!
 
Hi,


Total * Discount


gives the amount of money you discount,


Total * ( 1 - Discount )

gives the amount of money to pay. That assumes Discount is a percentage
value, from 0 to 1. In other words, 25% is 0.25.

In the debug (immediate) window, type the first line:

? CCur(124.67)*(1-0.10)

with a return, you should get

112.203



as for an amount of 124.67$, after a discount of 10%, 0.10, you still have
to pay 112.20$



Hoping it may help,
Vanderghast, Access MVP
 
Hi,


Total - (Total * Discount )

^


You typed -, instead of *.



Hoping it may help,
Vanderghast, Access MVP
 
Am I on the right track....The calculations seems correct but I want to be
absolutely sure. Discount is a percentage.

To calculate the Total Discount this is what I have:

TotalDisc: CCur([Total]*[Discount])


To calculate the Total, this is what I have as per Northwind example:

Total: CCur([Quantity]*[Price]*(1-[Discount])/100)*100


Let me know if that looks good. Thanks for your help!!
 
Hi,


If Discount is a percentage, a value from 0 to 1, ie 1 = 100% your formula
for TotalDisc is right, the formula to Total, a reserved word by the way, is
wrong:

[Total] : CCur( Quantity * Price * ( 1-Discount ) )

is what you need.




On the other hand, if Discount is a value from 0 to 100, ie, 100 = 100%,
then TotalDisc should be:

TotalDisc: CCur([Total]*Discount/100.0)

while the formula for Total should be

[Total] : CCur( Quantity * Price * (1- Discount/100.0) )



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top