EXERCISE TOPIC▼
- Access exercises (91)
- C# exercises (79)
- Excel exercises (278)
- Power Apps exercises (13)
- Power Automate exercises (18)
- Power BI exercises (139)
- Python exercises (28)
- Report Builder exercises (141)
- SQL exercises (198)
- SSAS exercises (51)
- SSIS exercises (46)
- SSRS exercises (99)
- VBA exercises (85)
- Visual Basic exercises (46)
POWER BI EXERCISES▼
POWERPIVOT EXERCISES▼
- PowerPivot data models (7)
- Pivot tables using PowerPivot (2)
- Using Excel tables (3)
- Using other data sources (1)
- Transforming data (Power Query) (7)
- Calculated columns (7)
- Measures (2)
- The CALCULATE function (15)
- More advanced DAX functions (5)
- Calendars (1)
- Date functions (10)
- Hierarchies (2)
- KPIs (5)
- Power View (4)
- Power BI Desktop overview (3)
- Power BI Desktop maps (1)
PowerPivot | Calendars exercise | Create and Use a Calendar Column for your Star Sign
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 ==> | PowerPivot (75 exercises) |
Version ==> | Excel 2010 and later |
Topic ==> | Calendars (1 exercise) |
Level ==> | Average difficulty |
Subject ==> | Power BI training |
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.
The idea behind this exercise is to create a pivot table showing how many dates there are for Pisces, as opposed to other star signs:

Pisces goes from 19th February to 19th March. It's only an approximation - if you're born on the cusp of Pisces and some other inferior star sign, things get tricky.
You can do this exercise in either Excel or SQL Server Managment Studio. Just follow the instructions under the appropriate heading below!
Excel Instructions
Create a calendar table for all of the dates in the year 2000:

The function used to give the star sign could be: =IF(MONTH([@Date]-19)=2,"Pisces","Inferior star sign") .
Save this workbook as Star signs. You must then close it down to import it into PowerPivot.
Use Other Data Sources to import this table, and then create the pivot table as shown above. Save this as Not all can be winners - Excel, and close this down.
SQL Instructions
Create a calendar table in Management Studio to hold the dates (you might as well do it within the MAM database). You could do this in script using:
CREATE TABLE tblStarSignDates(
[Date] datetime PRIMARY KEY,
StarSign varchar(20)
)
Add in one row for each date in 2000. To save typing the rows in one by one, you could use something like:
-- start with 1st Jan 2000
DECLARE @curdate datetime = '20000101'
-- add dates one row at a time
WHILE @curdate <=>=>'20001231'
BEGIN
-- add a record for this date
INSERT INTO tblStarSignDates (
[Date],
[StarSign]
) VALUES (
@curdate,
CASE
WHEN Month(@curdate-19) = 2 THEN 'Pisces'
ELSE 'Inferior star sign'
END
)
-- go on to next date
SET @curdate = DateAdd(day,1,@curdate)
END
Import this table, and use it to create the pivot table as shown above. Save this as Not all can be winners - SQL, then close it down.