thayduck
asked on
SSRS Column Summing IIssue
Date Amt
03/20/2010 100.00
03/22/2010 125.00
03/22/2010 200.00
03/23/2010 50.00
03/23/2010 250.00
In the above example of a ssrs report grouped on date and amt, is there a way on the footer line that i can sum up the Amt column but only sum the amts with todays date.
Lets say 03/23/2010 is todays date. I only want the sum total on the footer line to be 300.00.
Problem is that user can create report with only todays records or todays records and all history records with various dates. If user selects only to show records with todays date then the sum of that column is correct. But if they choose todays and history records then I stll want the final amt (for amt column) to only show a total of todays records only. I dont want history record amts included in final total.
03/20/2010 100.00
03/22/2010 125.00
03/22/2010 200.00
03/23/2010 50.00
03/23/2010 250.00
In the above example of a ssrs report grouped on date and amt, is there a way on the footer line that i can sum up the Amt column but only sum the amts with todays date.
Lets say 03/23/2010 is todays date. I only want the sum total on the footer line to be 300.00.
Problem is that user can create report with only todays records or todays records and all history records with various dates. If user selects only to show records with todays date then the sum of that column is correct. But if they choose todays and history records then I stll want the final amt (for amt column) to only show a total of todays records only. I dont want history record amts included in final total.
ASKER
The problem is that the report has 22 various amt columns that I would need to do this for.
I wanted to do this all in ssrs and not add more columns to the report query.
There is no way of doing this within the report itself with the data at hand?
Maybe create a function you can access within the report that would do what you are suggesting but within the report with data at hand.
I wanted to do this all in ssrs and not add more columns to the report query.
There is no way of doing this within the report itself with the data at hand?
Maybe create a function you can access within the report that would do what you are suggesting but within the report with data at hand.
I did eventually convince SSRS 2008 to do this, and I think SSRS 2005 can do it too. Just use the expression
=Sum(IIf(Fields!transdate. Value = <currentdate>, Fields!transamt.Value, 0))
Use whatever you prefer for <currentdate>, as long as it is something that evaluates to the right date.
I placed the expression in a textbox in a row just below the details group row, and outside of the details group. It does need to be inside the table, within the scope of the dataset, unless you specify the dataset name in the function. The latter form would be
=Sum(IIf(Fields!transdate. Value = <currentdate>, Fields!transamt.Value, 0), "datasetname")
I was able to put this latter expression in the page footer using SSRS 2008, even though the expression editor reported an error.
=Sum(IIf(Fields!transdate.
Use whatever you prefer for <currentdate>, as long as it is something that evaluates to the right date.
I placed the expression in a textbox in a row just below the details group row, and outside of the details group. It does need to be inside the table, within the scope of the dataset, unless you specify the dataset name in the function. The latter form would be
=Sum(IIf(Fields!transdate.
I was able to put this latter expression in the page footer using SSRS 2008, even though the expression editor reported an error.
ASKER
These totals need to be in the table footer line.
I tried putting your code there but get a error.
I tried putting your code there but get a error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Neither of these possible solutions will work for me in this report. I have decided to go in another direction, but thanks for your suggestions.
ASKER
Both of these solutions will work just not in my report.
Thanks for your suggestions though.
Thanks for your suggestions though.
You would either need to set a query parameter, @currentdate, with the current date or you would need to replace @currentdate in the query with a suitable SQL expression (I like "DATEADD(day, DATEDIFF(day, 0, getdate()), 0)" -- it returns the current date with no time).
If you add a group footer row to the table then you can access the sum column as "=First(Fields!dailysum.Va
I verified this in SSRS 2008; I don't have SSRS 2005.
Open in new window