Search code examples
reporting-servicesssrs-2008

Results of calculating with Sum (expression) give a wrong number in SSRS


I have a column which should calculate some numbers and sometimes it gives me the correct sum and sometimes it doesn't. I don't know why! Can someone please point me in the right direction?

I used this expression:

=Sum(Fields!TotalEmployees.Value)

When I don't choose something from filters on the top , it will give me the correct sum:

s


And when I choose something from the filters on the top, for example between 2 dates, it will give me wrong the sum:

enter image description here


Parameters & Body of report :

@EndDateFrom
@EndDateTo



b1


Solution

  • i solved this issue with changing my query ,where all calculating (AVG , Sum &.. ) happens in query , instead reporting services do it for me .. after that i got the correct number:

    SELECT t1.Departments, count(t1.id), avg(t1.age),sum(t1.TotalEmployees)/count(t1.id)
        AS TotalEmpl FROM (<current_query>) AS t1 <br> GROUP BY t1.Departments