Exercise: Use the SWITCH function to categorise directors

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the Wise Owl course listed below!

Category ==> SSRS Reporting Services  (53 exercises)
Topic ==> Revision of expressions  (3 exercises)
Level ==> Average difficulty
Course ==> Advanced SSRS
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

First create a report called Quantity not quality, and within this create a dataset to show how many films each director has made:

Dataset using grouping

If you're not sure how to group in a dataset in SSRS, see the note below.

The easiest way to apply grouping is probably with the right mouse button: 

Group by tool

You can right-click on the top part of your query to apply grouping.


Now create a table in your report to show this data:

Table of directors and films

Your table doesn't have to look anything like this!


Create a calculated field using the SWITCH function giving a rating for each director using the following rules:

Number of films made Rating
1 One-hit wonder
2-3 Casual director
4-6 Experienced director
7+ Prolific

When you preview your report, you should see something like this:

Directors with ratings

See if you can find the only director whose rating is Prolific (it might not be a surprise when you do).


Close this report down.

This page has 0 threads Add post