EXERCISE TOPIC▼
SSAS EXERCISES▼
SSAS - TABULAR EXERCISES▼
- Creating a data model (2)
- Excel pivot tables (1)
- PowerView (2)
- Power BI Desktop overview (1)
- Other data sources (1)
- Calculated columns (4)
- Measures (3)
- Changing query context (2)
- The EARLIER Function (1)
- DAX queries (3)
- Date calculations (3)
- Hierarchies (1)
- KPIs (2)
- Perspectives (1)
- Prototyping using PowerPivot (1)
- Security (2)
SSAS - tabular | The EARLIER Function exercise | Group shopping centres into bands, by size
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 ==> | SSAS - tabular (30 exercises) |
Version ==> | SSAS 2012 and later |
Topic ==> | The EARLIER Function (1 exercise) |
Level ==> | Harder than average |
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.
This exercise assumes that you have a base model set up (see one of the many other SSAS tabular exercises on loading tables from the Make-a-Mammal database and creating a model).
Open the Word document in the above folder, and paste it into your model to create a new table:

The new table, which is here called Categories.
Create a calculated column in the Centre table to give the value of the category by using this logic:
If you succeed (and there are many things which can go wrong!) you should be able to create this pivot table:

Just to ice the cake, the sizes have been sorted correctly.
Save your workbook as Mind-expanding, then close it down.
This will be the solution
=CALCULATE( VALUES('unit sizes'[Category]), VALUE('unit sizes'[Lower])<=EARLIER(tblCentre[NumberUnits]), VALUE('unit sizes'[Upper])>EARLIER(tblCentre[NumberUnits]) )
I got the same solution as above, but with using Switch. How can I use EARLIER here ?
We don't give out answers to exercises I'm afraid - there has to be some incentive to attend our courses! However, you can see how the EARLIER function works by watching this video (it'a about Power BI for Excel, but the DAX formulae and principles are the same) or viewing this blog.