Use 2 data sets in one chart in SSRS

杀马特。学长 韩版系。学妹 提交于 2020-01-03 08:58:10

问题


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.




回答2:


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



来源:https://stackoverflow.com/questions/24310179/use-2-data-sets-in-one-chart-in-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!