DAX | Understanding EARLIER exercise | Use EARLIER to summarise films by comfort breaks required

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 ==> DAX  (28 exercises)
Version ==>
Topic ==> Understanding EARLIER  (2 exercises)
Level ==> Harder than average
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).

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.

Open the Power BI file in the above folder.  As well as a list of films, it contains a table giving how many times the author would need to pop out for a comfort break during each film's screening:

Comfort breaks table

From this table you should be able to make a reasonable guess at the author's age ...


Note that the two tables are not joined together - nor should they be for this exercise.

In the Films table create a calculated column called NumberBreaks which shows for each film the number of breaks needed.  To do this you want to pick out the value of the Breaks column where:

  • The value of the lower limit in the ComfortBreaks table is less than or equal to this film's running time in minutes; and
  • The value of the upper limit in the ComfortBreaks table is greater than this film's running time in minutes.

To refer to this film you can either use the EARLIER function or create a variable.

Because you're not using an aggregation function, you'll need to use the VALUES function within CALCULATE to pick out what you can be confident is the only Breaks column value returned.

When you've finished, you should be able to create the following matrix:

Oscar breaks

You're going to be popping out more to see multiple-Oscar films like Titanic and The Return of the King than for less successful films, because they last longer on average.


If you still have time, try creating a second calculated column to do the same thing, but this time using the method you didn't use the first time.

Save this file as Wee report, 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 0 threads Add post