Use 2 data sets in one chart in SSRS

2019-06-17 08:36发布

问题:

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.

回答1:

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.