I am going to begin with a column chart. This might not always be the one that you want, but it's a great one for getting to grips with how to create charts in Reporting Services. And just to save some time, I'm starting here with a blank report where I've defined a data source pointing to the regular AdventureWorks database-- not the LT or DW one, just the regular one. So, the next thing I need to do is create a dataset. I am going to create one called SalesInfo. It will be embedded in a report, and I will select the AdventureWorks data source. Jumping into Query Designer, what I'm going to do is start drilling down into this database. I am going to go in to the Sales section.
But instead of going into Tables, I am going to go into Views, because there are some views in the AdventureWorks database that have already been predefined to join several tables together to provide some useful information. What I'm interested here is a view called vSalesPerson. This has already been configured that it can give me the information about each particular salesperson and the total number of sales they did this year versus last year. So, I am going to select the last name and then down here, SalesYTD and SalesLastYear.
Go ahead and run the query, just to test that. And it looks good. Now, as ever, I'm not focusing on this particular structure of this view in the AdventureWorks database. That's of no interest to me. I'm trying to point out that if you have data that is something like this, here's what you might do with it. Because we could just show this in a regular table data region on our report, but it would be hard to easily see what's going on. It's just a bunch of numbers. You can't scan it and see which one is bigger than the next one. You have to read it a little closer. So a chart will be useful here.
I am going to click OK and say that's my dataset, and then over to the Insert tab. I am going to find the Chart Wizard. In the next example, I'll use the Insert Chart option, but we will go with the Wizard for now. The Wizard doesn't really do an awful lot. First thing it's going to ask is, what dataset do you have? And of course, it's the SalesInfo one I just made. Click Next. I'm going to do a Column chart. Click Next. And then we have this page that looks very similar to creating a table or a matrix data region. And in fact, it is almost identical.
The pieces that I'm most interested in are what goes in the Values section and what goes in the Categories section. Values typically being the actual number that we are interested in, how we can compare something being greater than or less than something else. So what I am going to do is drag across SalesYTD into the Values section. But we are also interested in grouping, in categorizing the stuff. Well, I am going to do it simply by last name. This will give me a chart that will allow me to compare the values in a graphical fashion.
We will do something with SalesLastYear a little bit later on in this example, but for now, that will do. I will click Next. In the Style section, I will just select Generic. I don't need all the extra styling. This will do, for our purposes, and click Finish. I will just drag that a little wider, and just give it a simple title. Now, when you're looking at a chart in Design view, this is dummy data. It's not real data. To see the real data, we need to go ahead and run it. So I will do that now. There's our chart. It doesn't look great.
A few too many data points, a few too many people. I could change this by going back into Design view and actually just making it bigger. I could grab the chart and then grab the drag handle, drag it down, drag it to the right. But regardless, I've probably got a few too many data points if what I am wanting to do is actually compare salespeople in some meaningful fashion. Well, let's say that what I really wanted to see was the top 25% of my salespeople, to compare them. Now, I could do this a couple of different ways. I could go back to my dataset and change that so it only returns a few rows with the top sales numbers. Or I could apply a filter on the chart itself.
I am actually going to do it on the chart. So, we need to get into the properties of this chart after it's already been positioned in our report. This is another area where you have to be a little bit careful on what you've clicked on, because it's very easy to, say, click the Chart Title area where you have selected the title, not the chart. You will find that there are multiple pieces in here. We've got the Legend over here on the right-hand side. We've got Axis Title areas and information down on the left and on the bottom. So you need to be careful what you have selected. The best way to grab the chart is to click in a blank area just around here.
And what we're looking for is that Chart is being selected over in the Properties window. Again, another option you could do is if you have something selected like the Legend, I can then also hit the Escape key until I see the word Chart there representing yes, I actually am on the chart, not on a piece of text. Now, there's a couple of ways I can get to the properties of this. I could right-click an area here, but it's sometimes easy to miss the right spot. So, with the chart selected, I can also open up the Property pages from this section. Here we have some basic information, like the name of this chart, the visibility of it, and we have the Filters section.
I am going to add a filter in here to only include rows where the following conditions are true. What I'm interested in is where the Sales YTD are equal to-- well, I don't want an equal to; what I actually want is the top 25%. And I'll let it take care of selecting the right amount of rows here. Click OK. It doesn't change anything visual about the chart, but when we run it again, we have a much more straightforward list. We've now got five people that we are comparing and we can actually see all their individual names here.
But really, what I was more interested in is not just sales year to date; I can now see quickly how one person compares to another, but I also want to see how they compare to the sales last year. Well, I'll go back into the Design view. This is going to be another grouping, another category. We could have done it in the wizard, but we are out of the wizard. We can't go back into the wizard. So, here's how we would make a change to a chart after it's been positioned on the report. Now, you might first think, well, it's by selecting the chart and going back into those Property pages.
But no, that's not the way we do it. You might think that it's in the Property window itself. And no, it's not really there either, or not in any easily accessible fashion. Or you might also think, well, if I right-click an area of the chart, is it here? Actually, no, it's not in any of those places. But if you right-click the chart so you see the Chart dropdown here, what will also happen is over here on the right-hand side, you will have this other pop-up called Chart Data. You've got to be careful with this one because it's very common to have this hidden behind the Properties window or sometimes even moved off the right hand entirely just because you can't see that area of the Design layout.
But that's where you should find it, on the right-hand side of the chart itself. This is what is currently showing, the things that we had dragged into the right areas in the wizard: our values, which are chart Sales Year To Date, and our first category grouping, which was LastName. Well, all I'm going to do now is grab the SalesLastYear part of the dataset over here in my report data, drag it over into the Values section, and say that it's another bunch of values that I'm interested in. And Report Builder will take care of grouping everything in the right place.
It will take care of giving it a different set of colors. So, I will go ahead and click Run. And now we have the two sets of columns. We have the Legend being automatically generated over on the right-hand side, so it's very easy to scan, very easy to look at. And once we're happy with just being able to select the right part of the chart to figure out where the actual correct properties are, when we should be right-clicking and selecting the property pages, and when we should be moving over to the right-hand side of this layout so I can actually look at the chart data, there's a lot of things you can do with it.
Now, one of the options which you won't see in chart data but you will see just by right-clicking the chart itself--and again make sure you're right-clicking a blank area of the chart-- is the Change Chart Type. And I wanted to show this with the idea that even after we've configured it, I could change it from one to another. So, for example, we're currently a basic column chart, but I am going to come down and select one of the bar chart options, perhaps even the 3D clustered bar. Click OK. Now, we are actually done here, because it kept all the configuration that was already in there.
We are showing the same information, using the same dataset, and representing it with the same color. Bar and column charts, very similar to each other, bar charts just horizontal. Both of these are very easy to configure, and great to show direct comparisons.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98504 Viewers
61 Video lessons · 85797 Viewers
71 Video lessons · 69694 Viewers
56 Video lessons · 102009 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Your file was successfully uploaded.