Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

«December 2015»

T-SQL Tuesday #73 Invitation – Naughty or Nice?

Hello Dear Reader!  This is the first Tuesday of the month and you know what that means.  It’s time to announce the T-SQL Tuesday Topic of the month!  This is your opportunity to participate in the largest SQL Blog party on the intrawebs. 

T-SQL Tuesday is an event started by Adam Machanic(@AdamMachanic| Blog) back in 2009.  The basic idea one blogger hosts the party and others participate.  We announce the topic the first Tuesday of the month, December 1st 2015 for today, and everyone will post their blogs on the second Tuesday of the month, December 8th 2015 for the actual posts.  This month the host is none other than……….. drum roll………….. ME!

Read more

How to Make a Box Plot Chart in SQL Reporting Services 2008 SSRS

  • 12 November 2009
  • Author: MikeDavis
  • Number of views: 56869

In SQL server 2008 there are several new chart options. The Box Plot Chart or, Box and Whiskers Chart, or Candle Chart need a few calculations to make the chart work. The chart is made to show a series of numbers. Most box plot charts look like:

Box Plot Chart

This is a representation of a series of numeric data broken down by date. To explain how the chart is made we need to understand how the numbers are calculated. Lets assume on one day we have the numbers (3,7,8,9,12,15,16,19,21,25,22,23,26,30,35). We need five values from this field, Median, Max, Min, Lower Quartile and Upper Quartile. We may also have numbers that could be consider outliers if they are too large or small compared to the rest of the numbers. Usually this is 1.5 times the nearest Quartile.

The median is the number in the center of the numbers. In our example we have 15 numbers. The center number is the eighth digit which is 19. If the series of number is an even amount then the number would and average of the two center numbers. So if there are 14 numbers in the series the 6th and 7th digits would be averaged together to get the median.

The next two numbers are the quartiles. These are the numbers half way between the median and the the highest and lowest numbers. Again if there are an even amount of numbers you take the average of the two center numbers. In our example the lower quartiles is 9 and the upper quartile is 23.

The last two numbers are the minimum and maximum , in this case 3 and 35 respectfully.

Once we have these numbers we can build the Box Plot chart. Reporting services does not do a good job of calculating these numbers. The best thing to do is have analysis services calculate these for you or use a stored procedure to produce them. Lets assume we have a table that has these numbers calculated like so:

Box Plot Chart

Q1 is the Lower Quartile, Q2 is the upper Quartile.

Now we create a report with a data source and a dataset querying all the data from this table.

Next we drag in a chart to the report and select the Box Plot Chart.

Box Plot Chart

Then we drag the Date Column from our Dataset into the Category field below the chart.

Box Plot Chart

Then we drag the Max Column from our Dataset into the Data Fields above the chart.

Box Plot Chart

Then right click on the [Sum(#Max)] Grey box that was created in the Data Fields above the chart and select Series Properties.

Box Plot Chart

Click on the function button next to the fields and set the High Value to Max, set Low to Min, set Open to the Lower Quartile(Q1), and set Close to the upper Quartile(Q2).

Box Plot Chart

Adjust the formatting of the X and Y axis as desired and the labels and the chart should look like so:

Box Plot Chart

If we want the Median to show on the chart we need to add it as another series to the chart. Drag the median column from the dataset into the Data fields above the chart. Make sure you do not drop it on one of the existing series, place it to the right of them. It automatically sets it to Sum(median), we need to change this so it is just the median field. Right click on the Median series and select Series Properties.

Box Plot Chart

Click on the function box next to the High value and change the function to =(Fields!Median.Value). Then Click on the markers node on the left and select the desired marker type, size and color. Click on the fill node and set the color to no color. This will stop the line from appearing below the median. The report should look like so:

Box Plot Chart

To add the Outliers. We follow the same steps we did to add the median markers. Make sure to set the fill to no color.

The final results look like so:

Box Plot Chart

I removed the max field from the legend also. I did this by right clicking on one of the blue boxes and click series properties and setting the legend to do not show.

Rate this article:
No rating


Other posts by MikeDavis

Please login or register to post comments.