Cumulative percentages

S

sabunim

I have a table that will be used to create a report. Within this table are 3
main fields: Range #Cust Perct TotPerct
$0 50 25% 25%
$1-$5 20 10% 35%
$6-$10 10 5% 40%

The data above is just a quick example of the table and its data for the
purpose of this question. In the example the total #Cust is 200 so the
percentages are correct. However what I am looking for is the percentages to
accumulate so that I can see at what range do I reach a certain level of
customers. Using the example above, the fourth column needs to show that at
the $6-$10 range I have already reached 40% of the customers and this
cumulative percentage will continue downward until I reach 100%. The
calculation in the fourth column is what I cannot figure out. Any help is
very much appreciated. Thank you.
 
S

SuzyQ

Try something like this

in your report use an unbound textbox that will be for your totPerct. in
the detail record of the report on print event put the following code

dim dblTotPercent as double

sub detail_print
dbltotpercent = dblTotPercent + [perct]
me.totPerct = dbltotpercent
end sub
 
S

sabunim

Thanks for helping. I did what you suggested and but when I hit print
preview or just print, the screen flashes but nothing happens. I understand
the code you suggested and how it works but I should have initially mentioned
that I have been working in Access for many years but I am a novice when it
comes to code so my debugging skills are limited. Here is what it looks like:

Private Sub detail_print(Cancel As Integer, PrintCount As Integer)
Dim dblTotPercent As Double

Sub detail_print()
dblTotPercent = dblTotPercent + [perct]
Me.totperct = dblTotPercent
End Sub

End Sub


SuzyQ said:
Try something like this

in your report use an unbound textbox that will be for your totPerct. in
the detail record of the report on print event put the following code

dim dblTotPercent as double

sub detail_print
dbltotpercent = dblTotPercent + [perct]
me.totPerct = dbltotpercent
end sub


sabunim said:
I have a table that will be used to create a report. Within this table are 3
main fields: Range #Cust Perct TotPerct
$0 50 25% 25%
$1-$5 20 10% 35%
$6-$10 10 5% 40%

The data above is just a quick example of the table and its data for the
purpose of this question. In the example the total #Cust is 200 so the
percentages are correct. However what I am looking for is the percentages to
accumulate so that I can see at what range do I reach a certain level of
customers. Using the example above, the fourth column needs to show that at
the $6-$10 range I have already reached 40% of the customers and this
cumulative percentage will continue downward until I reach 100%. The
calculation in the fourth column is what I cannot figure out. Any help is
very much appreciated. Thank you.
 
S

sabunim

I figured it out and now its working! Thanks again for your help!

sabunim said:
Thanks for helping. I did what you suggested and but when I hit print
preview or just print, the screen flashes but nothing happens. I understand
the code you suggested and how it works but I should have initially mentioned
that I have been working in Access for many years but I am a novice when it
comes to code so my debugging skills are limited. Here is what it looks like:

Private Sub detail_print(Cancel As Integer, PrintCount As Integer)
Dim dblTotPercent As Double

Sub detail_print()
dblTotPercent = dblTotPercent + [perct]
Me.totperct = dblTotPercent
End Sub

End Sub


SuzyQ said:
Try something like this

in your report use an unbound textbox that will be for your totPerct. in
the detail record of the report on print event put the following code

dim dblTotPercent as double

sub detail_print
dbltotpercent = dblTotPercent + [perct]
me.totPerct = dbltotpercent
end sub


sabunim said:
I have a table that will be used to create a report. Within this table are 3
main fields: Range #Cust Perct TotPerct
$0 50 25% 25%
$1-$5 20 10% 35%
$6-$10 10 5% 40%

The data above is just a quick example of the table and its data for the
purpose of this question. In the example the total #Cust is 200 so the
percentages are correct. However what I am looking for is the percentages to
accumulate so that I can see at what range do I reach a certain level of
customers. Using the example above, the fourth column needs to show that at
the $6-$10 range I have already reached 40% of the customers and this
cumulative percentage will continue downward until I reach 100%. The
calculation in the fourth column is what I cannot figure out. Any help is
very much appreciated. Thank you.
 

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

Top