question

wolfeste avatar image
wolfeste asked

Calculate Perecentage Difference in SSRS

I am looking to get the percentage difference between two values returned in SSRS. One value is the previous year, the second value is for the current year. I tried the below script but it keeps failing on me. Anyone have some suggestions? I am also open to doing the calculations in SQL if that makes it easier. =(sum(iif(Year(Fields!ServiceDate.Value) = Format(CDate(Parameters!StartDate.Value), "yyyy"),Fields!TotalQty.Value,nothing)) - sum(iif(Year(Fields!ServiceDate.Value) = Format(CDate(Parameters!StartDate.Value), "yyyy")-1,Fields!TotalQty.Value,nothing)))/sum(iif(Year(Fields!ServiceDate.Value) = Format(CDate(Parameters!StartDate.Value), "yyyy")-1,Fields!TotalQty.Value,nothing))
sql-server-2012ssrs-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
wolfeste avatar image
wolfeste answered
I was able to get this working by with the same code above. The issue was that in my SQL Script i already had the "year" converted to yyyy and in the above script it was converting it to yyyy so it would error out.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.