Power BI | Calculated columns exercise | Adding new field to support reporting by thirds

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.

Software ==> Power BI  (111 exercises)
Version ==> Latest update
Topic ==> Calculated columns  (8 exercises)
Level ==> Relatively easy
Subject ==> Power BI training
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). Once you've done this:
  1. Go into SQL Server Management Studio;
  2. Open the SQL file you've just unzipped (you can press CTRL + O to do this); then
  3. Execute this script.

This will generate the database that you'll need to use in order to do this exercise (note that the database and script are only to be used for exercises published on this website, and may not be reused or distributed in any form without the prior written permission of Wise Owl).

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.

Sadly, your company has appointed a new FD who insists that you should report in thirds, rather than quarters.  The thirds should be named after his 3 pet cats:

Third Covers
Truffles January, February, March and April
Sprout May, June, July and August
Spot September, October, November and December

Start by importing all of the tables from the above database into a new model.  You'll need to create a relationship between the tblCalendar table and the tblPurchase table via the PurchaseDate field:

Linking tables

Link these two tables as shown.


Create a new calculated column in the calendar table using this logic:

  • If the MonthNumber column is less than or equal to 4, return Truffles;
  • Otherwise if the MonthNumber column is less than or equal to 8, return Sprout;
  • Otherwise, return Spot.

Use this to show a tree diagram proving that most sales are made in third 1:

Tree diagram

A tree diagram with data labels displayed.


Time for a new finance director?  Save this as Doing things by thirds, then close it down.

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 1 thread Add post
14 May 21 at 15:59


I followed the instructions and made a calculated column. While creating the tree diagram, I am getting an additional blank value. I checked all the table values, however, there are no balnk values in it.

I am trying to paste the screenshot here but it is not allowing me to paste.

Calculated field formula:

ByThirds = SWITCH(True, [MonthNumber] < 5, "Truffles", [MonthNumber] < 9, "Sprout", "Spot").

I have added this in this calendar table.  The values I am getting are:

Sprout - 22558
Truffles - 20763
Spot - 19611
(Blank) - 11483

Please help in resolving this issue.


14 May 21 at 17:09

We are planning on adding the facility to add images to posts at some stage soon ...

You've done everything right apart from one thing - when you created the relationship between the Purchase and Calendar tables, I suspect you linked them by the payment date not the purchase date.  Because some purchases have got null values for the payment date (because they haven't yet been paid), you get nulls in the results.

14 May 21 at 17:55

Hi Andy,

Issue resolved. Thanks a ton.