CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Calculated Totals in simple report

Print topic Send  topic

Author Message
w424637

Posts: 2
Posted: 03/24/2009, 2:33 AM

Hi
I have a simple query which produces a small table like

Company Sales Profit ROI

ROI is a calculated field in the query (Profit / Sales)

Problem is when I do a GrandTotalROI the only options I have are to Sum or average the ROI column - both wrong.

What I need is the GrandTotalROI to be a calculated field based on the GrandTotals of Profit and Sales.

Can I do this.

Now I could write a union query and bring in the data as a Grandtotal line correctly calculated. Trouble is it shows it then as part of my data table and not on the GrandTotal line.

please help.

Simon

View profile  Send private message
paulolg

Posts: 7
Posted: 03/24/2009, 5:45 AM

Hi Simon,
Can you show me your sql please? Oracle. sybase, sqlserver..???

regards
paulolg
View profile  Send private message
w424637

Posts: 2
Posted: 03/24/2009, 6:59 AM

SELECT racedata.TrackName, Sum(racedata.Bet) AS SumOfBet, Sum(racedata.Return) AS SumOfReturn, Sum([return])/Sum([bet]) AS ROI
FROM racedata
GROUP BY racedata.TrackName;

Using MSAccess

Now this produces a table
4 cols 2 rows. ROI calculated correctly.

If I put this into a report though and want a GrandTotal I have the issue that the ROI column should be the GrandTotalReturn/GrandTotalBet.

Currently I can Sum it - wrong or Avg it - wrong again - it needs to recalculate itself at the Grandtotal level.

Hope this explains the issue more.

Now I could add a union query in:

UNION
SELECT 'Total' as TrackName, Sum(racedata.Bet) AS SumOfBet, Sum(racedata.Return) AS SumOfReturn, Sum([return])/Sum([bet]) AS ROI
FROM racedata

This correctly includes the ROI calculation.

Trouble is in a report now I have three rows and it isnt defined / formatted as a total row on my final report.

help really appreciated.

I've read about BeforeShow codes etc but not clear on how these work.

thanks
Simon
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.