# Exercise: Create a KPI targeting sales against the previous quarter's

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 course listed below!

 Category ==> Power BI - Excel 2013  (25 exercises) Topic ==> KPIs  (2 exercises) Level ==> Relatively easy Course ==> PowerPivot / Excel Power BI
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.

The aim of this exercise is to create the following pivot table:

We'll aim for each quarter's total quantity sold to be at least 99% - and ideally 100% - of the previous quarter's total quantity sold. Lots of help follows!

If you haven't already done so, first run the SQL script in the above folder (copying and commercial use prohibited) to generate a database called MAM.  Also if you haven't already done so, run the spCreateCalendarTable stored procedure to create a calendar table.

Create a new workbook, and within this create a data model incorporating the tblCalendar, tblPos and tblTransaction tables.

Create the following two calculated fields:

Field Notes
This quarter The total of the Quantity column for any query context.
Previous quarter The total of the Quantity for the previous quarter (use CALCULATE and DATEADD to sum the figure for 1 quarter back in time).

We need to create the first field as an explicit calculated field because you can't use an implicit calculated field as the basis for a KPI.

Now create your KPI to produce the pivot table shown at the start of this exercise, using 99% and 100% as the thresholds.

Save this workbook (slightly surreally) as Kittens Prefer Iceland, then close it down.