Calculations with variables and DBcalc
Hi,
I have a query with a set of software and departments. Each software is used
by different departments (Purchasing, Sales, ...)
For example:
----------------------------------------
|Word |
|----------------------------------------|
|Group Header Software[1] |
|----------------------------------------|
|Purchasing No. of soft used : 3 |
|----------------------------------------|
|Group Header Department[2] |
|----------------------------------------|
|Detail |
|----------------------------------------|
| DBcalc : Sum (No. of soft used) |
|----------------------------------------|
|Group Footer Department[2] |
|----------------------------------------|
In the DBCalc, I have the sum of no. of soft used. I want for each
department calculate the percent of software used.
The calculation is simple, No of used * 100 / Sum (No. of used). I try to
use a variable to do this.
The problem is that DBCalc value in calculation is not the sum but the
partial sum depending on the line.
I explain with an example :
----------------------------------------------------------------------------
----------------------------
Purchasing No. of soft used : 3 Result 0 (3*100/0 !!)
Percent should be : 3*100/10 = 30
Sales No. of soft used : 6 Result 200 (6*100/3)
Percent should be : 6*100/10 = 60
Human Resources No. of soft used : 1 Result 11 (1*100/9)
Percent should be : 1*100/10 = 10
-----------------------------------group header :
department---------------------------------------------
----------------------------------detail------------------------------------
-------------------------------
Sum(No.of soft used) = 10 (DBCalc)
--------------------------------------------group footer :
department--------------------------------------
Do you have any ideas to help me ?
Thanks,
Emilie
I have a query with a set of software and departments. Each software is used
by different departments (Purchasing, Sales, ...)
For example:
----------------------------------------
|Word |
|----------------------------------------|
|Group Header Software[1] |
|----------------------------------------|
|Purchasing No. of soft used : 3 |
|----------------------------------------|
|Group Header Department[2] |
|----------------------------------------|
|Detail |
|----------------------------------------|
| DBcalc : Sum (No. of soft used) |
|----------------------------------------|
|Group Footer Department[2] |
|----------------------------------------|
In the DBCalc, I have the sum of no. of soft used. I want for each
department calculate the percent of software used.
The calculation is simple, No of used * 100 / Sum (No. of used). I try to
use a variable to do this.
The problem is that DBCalc value in calculation is not the sum but the
partial sum depending on the line.
I explain with an example :
----------------------------------------------------------------------------
----------------------------
Purchasing No. of soft used : 3 Result 0 (3*100/0 !!)
Percent should be : 3*100/10 = 30
Sales No. of soft used : 6 Result 200 (6*100/3)
Percent should be : 6*100/10 = 60
Human Resources No. of soft used : 1 Result 11 (1*100/9)
Percent should be : 1*100/10 = 10
-----------------------------------group header :
department---------------------------------------------
----------------------------------detail------------------------------------
-------------------------------
Sum(No.of soft used) = 10 (DBCalc)
--------------------------------------------group footer :
department--------------------------------------
Do you have any ideas to help me ?
Thanks,
Emilie
This discussion has been closed.
Comments
Below is a link to a small example showing how to use a two pass report with
the LookAhead property set to True to achieve what you are trying to do.
Hope this helps.
http://www.digital-metaphors.com/tips/UseLookAheadValueInCalc.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com