View Full Version : Interesting query for a report, don’t know how to do it


chile19
12-29-2004, 11:44 AM
Let say I have this very simple table:

Investments
Bank (number, the key of the bank)
TypeOfInvesment (number, can be 1 = deposit o 2 = mutual funds)
Amount (currency)

And the data is:

Bank TypeOfInvesment Amount
1 1 $100.000
2 1 $50.000
2 1 $10.000
3 2 $40.000
3 2 $50.000
4 2 $50.000
I need to create a report like this:

Bank Amount Total % Type %
1 $100.000 33.33% 62.50%
2 $60.000 20.00% 37.25%
3 $90.000 30.00% 64.28%
4 $50.000 16.67% 37.72%

The Total % is the % of the inversion over the total. On the other hand type % is the % of the inversion over the typeofinvesment total.

:confused:

Pat Hartman
12-29-2004, 06:03 PM
To calculate percentages in a query, you would need to do two totals queries and join them into the main query so you would have the divisors for the calculations.

If you let the report wizard build the report for you, take a look at the summary options. There is a checkbox for percent of total.

chile19
12-30-2004, 04:23 AM
To calculate percentages in a query, you would need to do two totals queries and join them into the main query so you would have the divisors for the calculations.

I truly understand what you mean, but I’m trying to do it without creating more tables and query….. more mass. Just on the report.
Any suggestion?
Thanks in advanced.

Ps. may well be with vb code.
ps2. sory for my english.

Pat Hartman
12-30-2004, 01:46 PM
I already told you: If you let the report wizard build the report for you, take a look at the summary options. There is a checkbox for percent of total.