# Power BI | Calculated columns exercise | Show the length of each film in hours and minutes

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).

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.

Create a new Power BI report, and load data from the Films.csv file in the above folder:

The only two columns you'll need to do this exercise are the film title and its length in minutes, so you could if you like use Query Editor to remove all of the other columns (this is optional).

Create a calculated column to show the number of minutes for each film using this formula:

Left over minutes = MOD([RunTimeMinutes],60)

This divides the film length by 60 and gives the remaining minutes (so Jurassic Park above should show 6, since it lasts 2 hours and 6 minutes).  Bear with ...

Add another calculated column to give the number of hours (this should equal the film length minus the left over minutes, divided by 60) using this formula:

Hours = ([RunTimeMinutes] - [Left over minutes])/60

You should now have something like this:

What your table should now look like.

Use the & symbol to concatenate or join together columns to create one more column:

The final column, giving the film length in hours and minutes.

Save this report as But what about Spider-Man, 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