Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Trouble with SUM() Expand / Collapse
Author
Message
Posted Friday, March 7, 2014 7:14 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 9:07 AM
Points: 11,157, Visits: 12,899
David,

Sorry I misunderstood your problem, I thought you were getting the total of all rows and wanted just the total for the filtered rows. Yes, what you are doing should work, but I would recommend pushing that down to the query by adding a column doing a sum(totalturnover) over() which returns the sum of all the rows in the results. Then in the total row on the report you'd use first(totalturnover) instead of sum. I'd do that because I find it easier to understand and maintain than hiding textbox and then referencing it in anther object in the report. Both work so it really comes down to personal preference.




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1548729
Posted Friday, March 7, 2014 7:24 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 8:24 AM
Points: 43, Visits: 234
No problem, it doesn't help when it's not a 'logical' request!

It's a work around up to a point, but by definition it's per page. I've made the pages as large as possible but if the report continues onto a second then the values are not the true totals. As it stands it's unlikely to be a multi-page report but should that arise I'll revisit the problem.

Once again thank you for your input.
Post #1548736
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse