Calculating Matrix Columns
In my SSRS 2005 report, I have a matrix with a column group that groups on the date. Users select a date range (usually the previous 7 days) and for each date in the date range a column is displayed containing a value called PercentUtilized. I need to calculate
the growth from the first column value to the last column value. I'm a bit confused as how to refer to those columns since they are dynamically generated when the matrix is created at runtime.
Has anyone done this before? How do I call those columns because I need to plug them into the formula for calculating percent change.
Thanks!
S
August 6th, 2012 6:32pm
This is only if the SUM function is not usable by you for whatever reason :-
Do it in the database - when your users pass through a datefrom and dateto parameter you can use these to perform any calculations you need.
You can add another row or column to your resultset in the database.
Then in the column grouping expression you could go =iif(Fields!DateColumn.Value = "MyFlagForTotalRows", "Total", Fields!DateColumn.Value)
So you display the normal date value, but if it's the total you can display a heading to suit. Sorting, and the need to change the date column to a string type to accommodate this will probably be needed.
Josh Ash
Free Windows Admin Tool Kit Click here and download it now
August 9th, 2012 1:13am
Hi all,
My solution ended up being creating an additional row group that was at the same granularity as the lowest level group I was displaying in the report anyway, and placing the calculation there, because I wanted to show the growth
overall and it didn't make sense to place the calculation in the column groups and have it repeat for each column. My end user didn't care about growth from day to day, just from the original value during the time frame selected and the end value during the
time frame selected.
So in my new row group I placed this calculation:
=((Last(Fields!PercentDiskUsed.Value)-First(Fields!PercentDiskUsed.Value))/First(Fields!PercentDiskUsed.Value))*100
I essentially ended up with a static column to the left of the dynamic column groups that calculates the percent change between the old value (first) and new value (last).
Shaunna
August 11th, 2012 12:39pm
Do it in the database - when your users pass through a datefrom and dateto parameter you can use these to perform any calculations you need.
You can add another row or column to your resultset in the database.
Then in the column grouping expression you could go =iif(Fields!DateColumn.Value = "MyFlagForTotalRows", "Total", Fields!DateColumn.Value)
So you display the normal date value, but if it's the total you can display a heading to suit. Sorting, and the need to change the date column to a string type to accommodate this will probably be needed.
Josh Ash
Free Windows Admin Tool Kit Click here and download it now
August 12th, 2012 12:57am
Hi Shaun !
You can refer the Dynamic Column Group cell by its name using below expression;
=ReportItems!YourTextboxName.Value
Please let me know if this doesnt work for you. Hope I have answered you correctly.
Thanks, Hasham Niaz
August 12th, 2012 1:12am