Hi
i need to add the column values of two Sub-matrix in SSRS...
Thank you in Advance
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tuhin PaulPosted Mar 24, 2025, 6:03 PM
Grouping and Filtering:
CategoryandRegion.IIfto filter data for specific regions.Dynamic Calculations:
Totals and Aggregations:
Sum()for aggregations and ensure the scope of the calculation matches your grouping.Tuhin PaulPosted Mar 24, 2025, 6:03 PM
Detailed Expression Breakdown
Filtering Data for Region A:
Salesvalues only for rows whereRegionequals "Region A".Filtering Data for Region B:
Salesvalues only for rows whereRegionequals "Region B".Adding the Two Sums:
Region AandRegion B.Tuhin PaulPosted Mar 24, 2025, 6:00 PM
Steps to Add Column Values of Two Sub-Matrices
Step 1: Organize Your Data
Ensure your dataset contains all the necessary fields for grouping and calculations. For example:
Category(e.g., Product Category)Region(e.g., Region A, Region B)Sales(e.g., Sales Amount)Step 2: Create the Sub-Matrices
Category(row group) andRegion(column group).Salesfield in the data cell of the matrix.This will create a table-like structure where:
Category.Region.Salesvalues for each combination ofCategoryandRegion.Step 3: Add Totals for Each Sub-Matrix
Regioncolumn group in the matrix and select Add Total .Salesfor eachRegion.Step 4: Add a Combined Total Column
To add the column values of the two sub-matrices:
Regiongroup.Category.The expression for the combined total might look like this:
Explanation:
IIf(Fields!Region.Value = "Region A", Fields!Sales.Value, 0)filters theSalesvalues forRegion A.Sum()calculates the total for the filtered values.Region B.Step 5: Format the Report
Tuhin PaulPosted Mar 24, 2025, 5:59 PM
You have two sub-matrices (e.g., grouped by categories) in your SSRS report, and you want to:
For example:
Tuhin PaulPosted Mar 24, 2025, 5:59 PM
To add the column values of two sub-matrices in SSRS (SQL Server Reporting Services) , you can use expressions to perform calculations dynamically. SSRS allows you to work with data from multiple datasets or groupings within a single report, making it possible to calculate sums for specific subsets of data.
Amira BedhiafiPosted Mar 24, 2025, 3:07 PM
It is either you create a report variable for each value you want to add.Set the variable values in each sub-matrix an d then reference these variables in an expression where you need the sum.
Or, you can add custom code to your report :
Set the values in each sub-matrix:
Display the sum where needed:
Another alternative, if both sub-matrices use the same dataset: