Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use 2 data sets in one chart in SSRS

Is it possible to have 2 data sets and display the data for them in one chart on an SSRS report or will I need to combine the data sets?

I have number of calls answered in one dataset and number of calls missed in another and want to show them both in a graph. The data is held in different areas which is why I didn't create it in one data set to start with.

like image 743
user3691566 Avatar asked Jun 19 '14 15:06

user3691566


People also ask

Can we use two DataSets in SSRS?

SSRS Shared DataSetsShared Dataset can be used by multiple reports.

Can SSRS handle multiple result sets?

You can't use a single SSRS result set to call a proc that returns multiple result sets and access it as a collection of result sets the way you can in . net. Once you have your multiple result sets created, you can create multiple tablix on your report, and designate in each one which result set it uses for its data.


2 Answers

This may not work for all types of charts, and does require your datasets to be constructed with common axis values:

  • Select the chart so that the "chart data" panel appears.

  • Click the green "+" above the "Values" pane. You'll see a list of fields in the dataset bound to the charts data region. Rather than choosing any of those, choose "Expression" on the very bottom.

  • Add a value from your other dataset - note that it will probably need to be wrapped in an aggregate function, like SUM or FIRST. For example:

    =sum(Fields!YourField.Value, "2ndDatasetName")

  • All datasets will need to have common axis values, otherwise you're in for a bad time. If you need to split them up, you can have TWO sets of axis values for each orientation (vertical, horizontal); to change which axis position is used, bring up the "Series Properties", choose the 2nd tab on the left ("Axes and Chart Area"), and choose the Primary or Secondary axis accordingly.

like image 155
kyzen Avatar answered Sep 29 '22 10:09

kyzen


You can use Lookup function to join two data-sets on common field (i.e. DateTime) and then drive part of the chart from first data-set and part from the other. It's like INNER JOIN in T-SQL. I tested it in my project and it works.

Source: http://www.techbrothersit.com/2016/01/how-to-display-data-on-single-tablix.html

like image 30
Mariusz Avatar answered Sep 29 '22 10:09

Mariusz