• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3301
  • Last Modified:

SSRS; How to Merge Two Matrices Together


In SSRS 2008 R2, I have two separate but very similar matrices.  Each is based on a separate dataset, and each dataset pulls from a separate SQL database.

Each matrix has two columns--Vendor ID and Monthly Purchases.

I want to join these two matrices into one.  But, what if the same vendor is in each matrix?  How do I join these two objects where vendors, as well as their Monthly Purchases amounts are combined (summed) seamlessly?

And, I'm going to have detail "drill-down" data for each matrix.  If I combine them, will those drill-downs still work?


1 Solution
ValentinoVBI ConsultantCommented:
As far as SSRS is concerned, you can't do that.  It's impossible to combine data from two datasets in the same data region (tablix).  Except when you'd use the lookup functions but it would be a tough job to achieve your combined sums.

So this means you'll have to handle it on the query side.  Are those two databases located on the same SQL Server database engine instance?  If yes, then you can reference the database name in the FROM clause:

SELECT <fields>
FROM DB1.Schema.Table
SELECT <fields>
FROM DB2.Schema.Table

Open in new window

Of course this implies that your databases have the same name on each environment (DEV/UAT/PRD).  To avoid issues with that you could consider using synonyms, possibly in combination with a linked server if you're dealing with two different instances.

In any case, if you can build a query that combines the data from both your tables, you'll be able to achieve your report requirement.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now