Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | DAX (59 exercises) |
Topic ==> | Variables (3 exercises) |
Level ==> | Average difficulty |
Subject ==> | Power BI training |
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.
Open the Music Tours - Variables.pbix file in the folder shown above. You'll find a table visual containing a list of music artists and a count of the shows they have performed.
The first two artists in the table.
The aim is to create a measure using variables which shows the percentage of unsold tickets for each artist. Create a new measure and use three variables to capture the following values (you can choose what to name your variables):
What to calculate |
---|
The total number of Tickets sold. |
The total number of Tickets available. |
The number of unsold tickets. |
Add a RETURN statement to the measure which divides the unsold tickets by the available tickets. Apply some formatting and display this measure in the table:
You may notice a discrepancy for one of the artists.
It shouldn't be possible to have a negative number of unsold tickets - the problem occurs because some shows have a value for Tickets sold but not for Tickets available:
The offending rows in the Show table.
To resolve this, modify the values stored in the first two variables so that they only include rows where both the Tickets sold and Tickets available fields are not blank.
The corrected results.
Create another measure which shows the difference between each artist's percentage of unsold tickets and the overall percentage of unsold tickets. Use variables to help divide the calculation into manageable chunks.
You could apply some conditional formatting to make the results easier to read.
One of the artists doesn't have any corresponding shows in the Show table, making the results look a little odd:
We only want to see artists who have performed shows.
Modify the measure so that it only returns a result if the artist has at least one show.
Save and close the report.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.