SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Matrix Total


Matrix Total

Author
Message
giontech
giontech
SSC Veteran
SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)

Group: General Forum Members
Points: 252 Visits: 130
Hello,

I'd appreciate if you guys help me with my problem in a matrix. In the following SSRS 2008 matrix, notice I have a Row named FieldName, and only one field in the Data area named Value. My question is: Let's say we have Field 1, Field 2, and Field 3, and in the "Total" area of Field 3, I want to display the result of a division of Field1/Field2. How can this be done?


THE-LIP
THE-LIP
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 30
can you explain it more..
davoscollective
davoscollective
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1631 Visits: 1008
Assuming your field1 and field2 are rows, you can create a row group. Generally groups rely on the dataset having the same value in a certain column.
e.g. If you have a "Country" column and some of the rows say "Canada" you can group rows by Country and all the "Canada" rows will be in the same group.
If you don't have any useful grouping column and you want to group all columns for the purpose of doing these totals, or divisions, you can use =1 as the grouping formula.

The easiest way to then do a total for the "sum[value] of field 1 / sum[value] of field 2" is to refer to the fields by their name (name of the cell/text box). Assuming you've named those cells "Field1total" and "Field2total"

So the formula looks somewhat like
=ReportItems!Field1total.Value/ReportItems!Field2total.Value

From there you need to be careful about not dividing by zero - for example if the Field2total cell is zero you will have further problems.

What I've said here may or may not work depending on your exact layout but the "ReportItems!" reference is super useful I've found.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search