Last active
December 11, 2015 05:39
-
-
Save dspolans/4553669 to your computer and use it in GitHub Desktop.
query based on start date and end date parameters. calculate: zscore, year totals, percent change, weighted average, averages, standard deviation, and an acceptable range for the data. used for trend analysis ssrs reports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT IBRS, IncYear, COUNT(IBRS) AS countibrs | |
FROM v_WIBRS | |
WHERE (TheDate >= @startdate) AND (TheDate <= @enddate) OR | |
(TheDate >= DATEADD(yy, - 1, @startdate)) AND (TheDate <= DATEADD(yy, - 1, @enddate)) OR | |
(TheDate >= DATEADD(yy, - 2, @startdate)) AND (TheDate <= DATEADD(yy, - 2, @enddate)) OR | |
(TheDate >= DATEADD(yy, - 3, @startdate)) AND (TheDate <= DATEADD(yy, - 3, @enddate)) OR | |
(TheDate >= DATEADD(yy, - 4, @startdate)) AND (TheDate <= DATEADD(yy, - 4, @enddate)) OR | |
(TheDate >= DATEADD(yy, - 5, @startdate)) AND (TheDate <= DATEADD(yy, - 5, @enddate)) | |
GROUP BY IBRS, IncYear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=AVG(iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-5,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-4,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-3,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-2,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-1,Parameters!startdate.Value))), Fields!countibrs.Value,NOTHING)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=round((Sum(Fields!countibrs.Value) / CountDistinct(Fields!IncYear.Value)) - StDevP(Fields!countibrs.Value)) & "-" & round((Sum(Fields!countibrs.Value) / CountDistinct(Fields!IncYear.Value)) + StDevP(Fields!countibrs.Value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-5,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-4,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-3,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-2,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-1,Parameters!startdate.Value))), Fields!countibrs.Value,""))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=(ReportItems!Textbox70.value - ReportItems!Textbox60.value) / ReportItems!Textbox60.value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=stdevp(iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-5,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-4,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-3,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-2,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-1,Parameters!startdate.Value))), Fields!countibrs.Value,NOTHING)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=SUM(iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-5,Parameters!startdate.Value))), Fields!countibrs.Value,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-4,Parameters!startdate.Value))), Fields!countibrs.Value*2,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-3,Parameters!startdate.Value))), Fields!countibrs.Value*3,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-2,Parameters!startdate.Value))), Fields!countibrs.Value*4,iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-1,Parameters!startdate.Value))), Fields!countibrs.Value*5,NOTHING))))))/1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=iif(Fields!incyear.Value = year((DateAdd(dateinterval.year,-5,Parameters!startdate.Value))), Fields!countibrs.Value,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=(ReportItems!Textbox70.value - ReportItems!Textbox60.value) / ReportItems!Textbox46.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment