SSRS Column chart, total as last column

2019-09-18 07:07发布

问题:

I've got the following column chart: Product names as Category groups with values for budget and revenue on each column. Now I want to create a final column (Total) which is the sum of each column. ie. one column with the total value of the budget and one with the total value of the revenue.

Can this be done directly in the graph without having to do the calculations in the dataset? It's very easy to add a total to a table but seems to be hard to add it to a chart.

回答1:

No, you cannot just add a total column like you can add a total to a table and you are correct that the best approach is to modify your dataset to query.

Either perform a UNION to append a total row or utilize GROUPING SETS (if you want to get fancy) and you should get what you need.

Example UNION:

SELECT product, bedget, revenue
FROM myTable
UNION ALL
SELECT 'total', SUM(budget) as budget, SUM(revenue) as revenue
FROM myTable