Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Combining two queries/datasets into a single table in SSRS

Posted on by 2,095

Hi all

I've got a question and after many attempts at googling, I can find any solutions to this. I've got two queries relating to two different entity data sets. There is no relationship between the two entities (no 1:N, N:1 or N:N relationships) but I've set the fields in each entity to match each other exactly. 

What I want to do is bring those two datasets into an SSRS report via Microsoft Visual Studio but I don't want to have it as two different tables but have one overlay their data on top of the other in a union of sorts in 1 table. This is so that we can then sort or group both datasets in a single table. As an example the two queries I've got contain:

Query 1 - Entity 1

Entity 1-name field    Entity 1-Subject field      Entity 1-Organisation Lookup field

Name value 1                Subject value 1                 Organisation lookupvalue 1

Query 2 - Entity 2

Entity 2-name field     Entity -Subject field     Entity 2-Organisation Lookup field 

Name value 2                Subject value 2               Organisation lookupvalue 2

I want to merge/append the two datasets together in SSRS so that it produces a single table via SSRS so the final output in SSRS will be:

Combined-Name field    Combined-Subject field      Combined-Organisation Lookup field

Name value 1                    Subject value 1                      Organisation lookupvalue 1

Name value 2                    Subject value 2                      Organisation lookupvalue 2

As noted there isn't a entity relationship link between the two and I simply need to append/overlay one on top of each other so that I can do a row grouping on a single table as opposed to two.

I understand Fetch does not allow unions and some of the outer join solutions listed require a connecting data point. Is there a easy way of doing this.

Any help will be greatly appreciated and thanks in advanced! 

Kind regards,

Mike

*This post is locked for comments

  • Cindy P Profile Picture
    Cindy P 5 on at
    RE: Combining two queries/datasets into a single table in SSRS

    Hi Mike.  I'm curious to know if you ever got an answer to this?   I have a similar need and haven't found anything usable.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Combining two queries/datasets into a single table in SSRS

    You can amalgamate the information from the link entity to one of the other main entities, retrieving that data in one go and then join the two datasets using lookup from within SSRS

    ETA: You might want to investigate using sub-reports

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Combining two queries/datasets into a single table in SSRS

    I don't think SSRS has anything that can help you here. Any table / matrix can only be associated with one dataset (for completeness, you can reference other datasets in the expression for a field, but this doesn't help).

    You could display 2 tables, one after the other to make it look like a combined table, but you couldn't sort across the tables, for instance.

    Or, as both data sets have a lookup to an organisation, you may be able to use on query with outer joins, with the organisation as the connecting data point

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans