0
votes

I'm trying to understand how ssrs formats the way data is presented. I have a table in ssms and a sp that gets the data from that table. The sp code is:

select *
from [CustData]
where 1 = 1
and (reportYear = @dbParam_reportYear or reportYear = @dbParam_reportYear-1 )
and marketCode=@dbParam_marketCode
and brandName=@dbParam_brandName
and (contactSegmentDesc=@dbParam_contactSegmentDesc)
order by reportYear ASC, reportMonth ASC

This obviously returns the data row by row i.e. if the report year param is 2014, then the rows with 2014 and then rows with 2013 data.

image:enter image description here

This is then used in ssrs in a report but the data is presented by columns. The column group is like [segmentDesc] [reportMonth] [reportYear] followed by all the data that is retrieved.

image: enter image description here

I need to know what is formatting the data output from row by row to column by column presentation. I do suspect its the column groups but need to confirm. I am new to this.

Getting difference of the values:

enter image description here

1
Search for SSRS MatrixIgorM
Typically the column groups let you create matrix while row groups are usually used to create tables. The column group in your image is like Month as parent group and Year as child group.alejandro zuleta

1 Answers

1
votes

This can be conducted with use of SSRS matrix. Here is a nice tutorial: https://www.youtube.com/watch?v=zERexbgCG5A

The delta can be calculated with the following approach: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/e77d6526-cadc-4d14-8ca3-997d58cb7c4a/ssrs-matrix-difference-between-columns?forum=sqlreportingservices

Notice the following:

=(Code.GetMaxValue(RunningValue(Fields!Month.Value,CountDistinct,"Services"),(Fields!Amount.Value)-Previous(FIRST(Fields!Amount.Value))))