Power BI | Introduction to DAX exercise | Create a couple of measures to show average Brexit votes

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.

You can learn how to do this exercise on the relevant Wise Owl classroom training course (sadly for the moment only in the UK).

Software ==> Power BI  (92 exercises)
Version ==> Latest update
Topic ==> Introduction to DAX  (3 exercises)
Level ==> Relatively easy
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 file, and load the Excel workbook from the above folder; you can go to the original Electoral Commission source data from a link here or at http://bit.ly/2IPA9JS.

Create a measure to show for any filter context the total remain vote divided by the total electorate.  Here's what this should show:

Remain votes first

The first few rows of a table showing our measure by area (note that we've formatted it as a percentage).

 

The measure should be a simple calculation of the form SUM(X) / SUM(Y).

Too easy?  Create another measure to show the total value for any filter context of the difference between the leave and remain votes, to get something like this:

Total leave surplus

Although it was only the 5th highest in the remain votes table by proportion of electorate, City of Edinburgh contributed by far the most votes to the remain cause.

 

Use the SUMX function to sum the expression X - Y over the Voting table, where X = the number of leave votes and Y = the number of remain votes.

Save this as Water under the bridge, then close down the Power BI instance you're using.

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 2 threads Add post
03 Oct 19 at 15:30

Total Remain = sum(Voting[Remain])

Total Leave = SUM(Voting[Leave])

Total Electorate = sum(Voting[Electorate])

Avg = divide([Total Remain],[Total Electorate],0)

Diff = [Total Leave]-[Total Remain]

18 Sep 19 at 16:39

I'm very new at DAX, this are my solutions: 

Measure 1 = SUM(Voting[Remain])/SUM(Voting[Electorate])

Measure2 = CALCULATE( (SUM(Voting[Leave])-(SUM(Voting[Remain]))))*0.001

Does anyone have the real ones? Or just a different way?