If your dataset looks like the table at the top of your screenshot then that's going to make life difficult. You said you did some unions and aggregations to achieve this so you're probably doing too much at this point.
What you need to pass to SSRS is a simple list of the values. I've recreated (more or less) your dataset but as a simple normalised table. You can reproduce this step-by-step like this.
- Create a new report.
- Add a new datasource (point it to anything we won't be getting real data)
- Add a new data set and use the following query to emulate your data
..
DECLARE @t TABLE(Dept varchar(10), Yr int, Amount int)
INSERT INTO @t VALUES
('Dept. A', 2014, 42),
('Dept. A', 2015, 49),
('Dept. A', 2016, 40),
('Dept. A', 2017, 47),
('Dept. B', 2014, 33),
('Dept. B', 2015, 32),
('Dept. B', 2016, 33),
('Dept. B', 2017, 34),
('Dept. C', 2014, 30),
('Dept. C', 2015, 32),
('Dept. C', 2016, 34),
('Dept. C', 2017, 36)
SELECT * FROM @t
The dataset will return a simple table as three columns, Dept; Yr; Amount
- Insert a new line chart on your report
- Click the chart area so you see the Chart Data dialogue
- Drag the
Amount
field to `Values'
- Drag the
Yr
field to Category Groups
- Drag the
Dept
to Series Groups
That's it, done! The chart will look like this (I thickened the lines and added markers for clarify)
In my example, I also added a matrix to replicate the table you had in your screenshot. If you need to do this then...
- Insert a matrix onto your report
- Drag
Dept
onto Rows
- Drag
Yr
onto Columns
- Drag
Amount
onto Data
The final design looks like this.
The final output looks like this.
Note that this process will work even if you have lots of data in your dataset for each dept and year, SSRS will aggregate this for you so often you will not need to do simple aggregations in your dataset (although it can perform better when you do)