How to divide a sum?
I got a report service control on an aspx page in an silverlight application to be able to print a bill. Summing up a all positions works without problems: =Sum(Fields!SalesPrice.Value) Now I need to calculate the taxes and would need an expression like this: =(Sum(Fields!SalesPrice.Value))/100)*value ..but that seems not to work, always get an "error" in the field, when I print the report. Any help is appreciated (-: regards, Jan
May 23rd, 2012 5:05am

What error do you get? Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 5:12am

Just states #Error in the field as you can see. No idea if "=(Sum(Fields!SalesPrice.Value))*100..." is a correct statement...couldnt find any references if that kind of statements are allowed/correct or not.
May 23rd, 2012 5:26am

Hmmm just did some testing and it works just fine. Is that possible to calculate it via T-SQL? SELECT <columns>,SUM(val) OVER (PARTITION BY col) * 100 FROM tbl Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 5:41am

hi There Can you please put cdec before that and see if it works for you cdec((Sum(Fields!SalesPrice.Value))/100)*value) Many Thanks Syed Qazafi Anjum
May 23rd, 2012 5:54am

hi There Can you please put cdec before that and see if it works for you cdec((Sum(Fields!SalesPrice.Value))/100)*value) Many Thanks Syed Qazafi Anjum =CDec((Sum(Fields!SalesPrice.Value)) - 100) ..same result. Really no idea why its doesnt work :s Added as workaround an additional field in my class and calculating my values there at the moment. Edit: even that wont work: =CDec(Sum(Fields!SalesPrice.Value)) Displaying =Sum(Fields!SalesPrice.Value) works fine though as already mentioned. ...must be a stupid mistake, but really cant figure it out.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 6:06am

Hello JanD87, Please try to use the following expression in your report: =CDec(Sum(Fields!SalesProce.Value))-100 Regards, Bin LongBin Long TechNet Community Support
May 25th, 2012 1:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics