Given the following data set:
DECLARE @temp TABLE (
[Company] [INT]
,[Year] [INT]
,[PAID] [DECIMAL](18,2)
,[Billed] [DECIMAL](18,2))
INSERT INTO @temp
SELECT 2,2005,8328364.00,639739.00
UNION ALL
SELECT 2,2006,12770109.00,599937.00
UNION ALL
SELECT 2,2007,883021.00,34179.00
UNION ALL
SELECT 2,2008,876531.00,31421.00
UNION ALL
SELECT 2,2009,1947464.00,63322.00
UNION ALL
SELECT 2,2010,717350.00,22072.00
UNION ALL
SELECT 2,2011,895174.00,28444.00
UNION ALL
SELECT 2,2012,1091637.00,36853.00
UNION ALL
SELECT 2,2013,699646.00,23355.00
UNION ALL
SELECT 2,2014,1623403.00,58649.00
UNION ALL
SELECT 2,2015,566479.75,20463.00
UNION ALL
SELECT 2,2016,128700.00,2990.84
select *
from @temp
My SSRS 2014 report contains a Year parameter.
I'm having a difficult time with totaling based on certain years. I will need to have 3 totals lines, 1 of which will be a total of all years, and the other 2; a 3 year total and a 5 year total. The 3 and 5 year totals will be the total of the paid and billed fields based on the parameter year and 3/5 prior years, including the parameter year.
For example:
Parameter Year = 2015
SSRS output on totals lines should read:
Ideally, I would've liked to handle this totaling in T-SQL itself, but this unfortunately is only a small piece of the puzzle in this particular report and i had to write a complex solution in SQL and SSRS to make it work for the client. Basically, the report when finished will rely on a yearly totals data set without calculated total fields, and all totaling done within SSRS itself.
dataset
for theyear totals
based on theparameter year
? – SS_DBA