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.

The answer to the exercise will be included and explained if you attend one of more of the courses listed below!

Software ==> Power BI  (88 exercises)
Version ==> Latest update
Topic ==> Calculated columns  (7 exercises)
Level ==> Relatively easy
Courses ==> Introduction to Power BI  /  Fast track Power BI/DAX
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:

Films table

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:

The columns created

What your table should now look like.

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

Hours and minutes

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

Save this report as But what about Spider-Man, then close it down.

This page has 0 threads Add post