Problem : How do I create a variance column in SSRS / Report Builder
Good Evening All,
Using SSRS 2008 and Report Builder…
I have a recordset of financial transaction over the last two years
(2010, 2009) that I am presenting in a tablix.
The tablix has a “row group” where I am grouping on product type, and
a “column group” that I am grouping on year(transaction date).
So when I expand the report, the resulting report looks something like
this:
Product -2010 -2009
Item 1 $10000 $8000
Item 2 $5000 $4000
Item 3 $30000 $25000
So now what I need to do is create a variance between the two years, but for
the life of me I can’t figure out the right expression to dynamically
pull in the column group amounts so I can do some math on them.
Thoughts?
Solution: How do I create a variance column in SSRS / Report Builder
As you’ve probably already concluded, this is not very straightforward due to the dynamic nature of the tablix (matrix).
But it is possible. There’s a very detailed explanation in the following article. Checkout Technique 5, it explains how to calculate the difference between two years. Which is exactly what you’re looking for.
http://www.simple-talk.com/sql/reporting-services/advanced-matrix-reporting-techniques/
You’ll become good friends with the InScope() and IIF() functions 🙂
Good luck (it will be tricky, careful with closing all brackets as expected),