*** Expressions Using Values from Two Different Matrices in SSRS


I am trying to create a % expression in Matrix_A that uses numerator from Matrix_A and denominator from Matrix_B.

Matrix_A has a Total row text box populated as SUM(TOTAL)... next to it I want a % box populated with:

Matrix_A.SUM(TOTAL)  /  Matrix_B.SUM(TOTAL_MBRS)... which is the Total row from Matrix_B

Is this possible?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
Not sure if it will work but I guess it's worth a try.  You could try referencing the textboxes that contain the SUM() using this syntax: ReportItems!TheMatrixASUMTxtbox.Value / ReportItems!TheMatrixBSUMTxtbox.Value
Jim HornMicrosoft SQL Server Data DudeCommented:
Just a thought ... avoid this entirely by calculating the percent as columns in T-SQL, that way all SSRS has to do is display those columns.
dunkin1969Author Commented:
Thanks ValentinoV.  I errored out trying that method, but now will try other variations of it.  (Use text box vs matrix, eliminate calculatiion, etc)
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

dunkin1969Author Commented:
Thanks JimHorn... I was going to do that as an alternative.  I was just trying to figure out if it was possible to do in SSRS... as it would make life so much easier for me.  I'm used to Business Objects where it was so easy to reference other text boxes/cells, even if the other text boxes were text, formulas, calculations, etc.  

I create so many calculations on the fly in SSRS (using fields from multiple datasets) , that it would be time consuming to go and redo each query in each dataset.
Jim HornMicrosoft SQL Server Data DudeCommented:
ValentinoV is one of the most experienced SSRS developers we have here, so if his answer starts with 'Not sure if it will work' then that's a sign to redesign another way.

Besides, if you have T-SQL in SP's that are the data source for two matrixes, it should be a lot easier to handle the percentage there then rely on an SSRS expression.
ValentinoVBI ConsultantCommented:
If referencing the textboxes didn't work you could try using the SUM() function with scope specification, but that will probably not be straightforward either unless you need the actual real total of a column over the whole dataset.  In that case:

=Sum(Fields!SomeField.Value, "SomeDataset")

As scope you can also specify the group names as set up in your tablix but I think that will only work when the textbox containing the expression is located within that same tablix...  Which is possibly where your textbox is, so I guess this might work after all :)

But still, if the above won't work then, as Jim said, consider calculating this in a query...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dunkin1969Author Commented:
Thanks ValentinoV.  I'm still getting errors so I'm going to calculate using the query.  Thanks for the input.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.