Matrix in SSRS and RDLC
In SSRS or RDLC matrix is only control which provide you option of generating columns dynamically from data. In this one or more column act as source of column definition and one or more column act as value source. Below is the tutorial for Matrix and script used in tutorial:
Topics:
1. Creating a Matrix
2. Validation Data
3. Transforming Data in format suitable for matrix
4. Transforming Complete Table
Rule:
Every thing should be data/Value
SELECT t.*, tf.id FROM [TableToTransform] TF CROSS APPLY ( VALUES ( 'Data1', Data1 ), ( 'Data2', Data2 ) ) t(Title, Value) SELECT t.* FROM Expense ex CROSS APPLY ( VALUES ( 'Month1', MONTH1, Category ), ( 'Month2', MONTH2, Category ), ( 'Month3', MONTH3, Category ), ( 'QTRMonth', QTRMONTH, Category ) ) t([Title], [Values], [Category])