# How to compare column totals in an ssrs matrix?

I have a matrix report that looks like this:

Product        Month1     Month2    Month3
xxx               123.45     234.56    345.67
yyy               987.65     876.54   765.43

Column group is month (there can be more than 3), row group is product (many rows)

I need a column after months 2 and 3 (etc..) with the differences:

Product        Month1     Month2   Diff 1-2  Month3  Diff-2-3
xxx               123.45     234.56    111.11  345.67    111.11
yyy               987.65     765.43    222.22  654.32    111.11

How do I set up the column with the differences in it to be hidden the 1st time, and subsequent times have the difference between the current and previous iteration?

Thanks

Asked:
###### Who is Participating?

Author Commented:
I figured out how to use code to acomplish my task.  I was using the 7 day free trial, and since I did not get answers to either of the questions I posed, I opted to cancel.  I didn't realize that I could still post a reponse, which would have been the polite thing to do.  I apologize for letting the question linger into abandonement.
0

Commented:
Try setting the Hidden property to be based on an expression which comes out as True if the value of the first column isn't the minimum one (based on the outer scope).

I should point out that this isn't something I've tried before...

Rob
0

Author Commented:
How do I know if it's the 1st column or it's subsequent columns?  What variable holds the column number?
0

Commented:
You'd need to compare it to something you know is the minimum.
0

Author Commented:
Perhaps I'm not asking the question in the right way.

Specifically, how do I set up the column with the differences in it?  What is the expression that will give "diff between this amount and the previous amount"?

Can it be done with custom code?  How is the custom code executed?
0

Author Commented:
Can anyone describe how custom code might be written to save the previous column's data and use it to compare to the current column?
0

Commented:
Reporting Services has a function called Previous which may do it for you - have a play and see.

Rob
0

Commented:
Phoobar,
I have a similar problem. What is the solution?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Already a member? Login.

All Courses

From novice to tech pro — start learning today.