Will a matrix on SSRS split the data between two datasets which dont have common key but common dimensions ?

Mudassar A 491 Reputation points
2020-11-13T16:42:38.257+00:00

Will a matrix on SSRS report split the data between two datasets which don't have common key but common dimensions or merge ?

Attached is a screenshot of two tables and expected and current o/p of matrix. Note id is not used to join here and we are merging two datasets which are not directly linked.

I want to know the expected behavior of the ssrs matrix when 2 datasets are joined which have no common keys but dimensions.

39689-image.png

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,923 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,586 Reputation points
    2020-11-16T09:20:33.877+00:00

    Hi @Anonymous
    Depending on the query, the SSRS datasets are independent from each other.
    In one matrix you could only have data from one dataset. But you could join the two table before using them in SSRS.
    Try the following query:

    select * from TableA  
      
    select * from TableB  
      
    ;with cte as  
    (  
    select a.Product_code,a.unit1,b.unit2  
     from (select Product_code,sum(unit1) unit1 from tableA group by Product_code) a  
    inner join (select Product_code,sum(unit2) unit2 from tableB group by Product_code) b  
    on a.Product_code=b.Product_code  
    )  
      
    Select * into TableC FROM cte  
    

    output:
    39967-01.jpg
    Hope this helps.
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Mudassar A 491 Reputation points
    2020-11-24T22:33:56.697+00:00

    Thanks, I have one only one dataset on SSRS report and this dataset has sub queries ( Union of 2 datasets(sub queries))


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.