Upload
david-onder
View
88
Download
4
Embed Size (px)
Citation preview
1
Home of the Catamounts and the 2009 Sudler Trophy winners.
Manteo Mitchell graduated with a bachelors and masters degree from WCU.
Greg Holland, pitcher for Kansas City Royals, was a Western student.
3
4
5
6
7
8
Using Access for workshop, but data is commonly in SQL Server or Oracle database due to Access size limitations and access issues.
9
10
11
12
13
14
15
16
17
18
There is delay on lower rectangles
19
20
Can put multiple variables in each area, pivot table accommodates.
Totals at each level are aggregate of ALL elements at levels below (including repeated elements).
21
22
23
Make sure it is loaded
24
If Power Pivot ribbon not there, needs to be enable.
Enable Developer tab, then enable Power Pivot
See Appendix B
25
26
Select appropriate add‐insBe careful of memory usage
27
Most used are Manage and Calculated Fields
Switch to Power Pivot with Manage
28
Features – Excel‐likeRibbonFormula barData area
From Data imports from Microsoft database sources
Oracle, Microsoft Excel, etc. are found under From Other Sources
29
30
Can import multiple tables at one from same source database
OR
Can write a complex SQL query, possibly joining multiple tables
31
Select tablesCan rename before importing (allows for importing same table multiple
times – yes, there is a reason for this)Can preview the table prior to importCan filter table to load only necessary columns and rows
Clicking OK begins import of all selected tables
Progress and completion status are shown, including any errors generated (# rows imported is also shown)
32
Excel‐like environmentTab at bottom is table/alias nameColumn names along top with filtersCharacter data is left justified, numeric is right justified
NOTE: Filtering here does not change the filtering in Excel. It is only available to help review the data while in Power Pivot
Lower pane is the calculated field area
33
To insert pivot table, click the button on the Home tab in the ribbon and choose New Worksheet.
34
Look VERY similar
Power Pivot allows for multiple tables in one pivot table – WHAT!?!?!?Order of fields is alphabetical in plain but “by column” in power pivot
35
Brief exercise to recreate pivot table from Exercise 2.2 using Power Pivot
36
37
38
Three waysDesign ‐> AddDouble‐click Add ColumnRight click and select Insert Column
39
Formula bar supports IntelliSense, just like Excel
NOTE: Table and field names are included
On far right of formula bar, click drop‐down to expand formula area (just like Excel)
Best practice ‐ Enter formulas using SHIFT‐ENTER and spaces to format
40
Can rename column only after column has been created
Best practice – name columns in table as ‘Table’[Column] and name calculated fields as [Calculated Field]
Can set formatting on column or calculated fields – applies to all uses
Can hide a column from the resulting pivot table, power view or power map
This formula is DAX (looks a lot like an Excel formula)
41
Drag new field to VALUES section and it is added to pivot table just like any other value
42
Two evaluation contexts. All calculations are done in one of these two contexts.
43
SAT – Total is calculated in row context within the table
44
For the SAT ‐ Total calculated columnNo row specified in formulaOperates on row‐by‐row basis, as expected. This is just like an Excel table
45
46
To calculate the Average SAT for Information Management, the following filters apply:
Semester=“Fall”Academic Year=“2003‐2004”College=“College of Information Studies”Department=“Information Management”
NOTE: Program=All programs even though Program is included in pivot table
Calculated Fields are computed using filter context
47
48
A calculated field is often called a measure, especially by everyone outside of Microsoft
49
Can add from Excel or from Power PivotEasiest way is from Excel
50
First – specify name of calculated fieldSecond – specify formula
IntelliSense applies in the formula box as expected
51
52
First – specify name of calculated fieldSecond – specify formula
IntelliSense applies in the formula box as expected
53
Creating calculated field this way will automatically add it to pivot table
Notice difference in counts
Power Pivot calculations done one a cell‐by‐cell basis, irrespective of the other cells (filter context).
54
Creating calculated field this way will automatically add it to data model
Notice the formula is what was entered in the dialog previously
55
56
57
Filters in CALCULATE add to the filter context, replacing any filters on a matching field
Filters must use Boolean conditions or provide the complete list of acceptable values (FILTER)
After all filters have been evaluated, they are ANDed and the expression is calculated
Each filter is evaluated in the original filter context of the CALCULATE call
Operators to use
For multi‐line use SHIFT‐ENTER
58
Boolean Condition: WorkshopData[Class level]=“Freshman”
59
Notice First‐time Freshmen Distinct Students always matches the Freshman, Yes value.
60
61
Very useful for calculating the denominator in the % of population equation
62
Whatever might be specified in the filter context, this will calculate [Distinct Enrolled Students] for all class levels.
63
See how ALL works, filtering on Class Level, but not on Program Name
64
DIVIDE is a safe divide which will replace any errors with zero
65
66
67
Open from Hands‐on Exercises. Read instructions carefully to ensure you are in the correct environment.
68
Can be used to override all filters on a table at once
Filter context is passed to table and filter expression
Creates a row context (masking any
69
previous row context) for evaluation
Returns table of all matching values
When used in CALCULATE, the CALCULATE filter is updated after FILTER is executed
69
Table being filtered is WorkshopData
FILTER must calculate [Average GPA Enrolled Undergraduates] first, in the calling filter context and then use that value to evaluate this expression in row context.
This returns a table with all matching rows for evaluating [Distinct Enrolled Students].
70
71
Needed for exercise.
72
73
74
75
On the INSERT tab, click Map in the Power Map section
To use Power Map, you need a Power Pivot model or you can select data in Excel and click the drop‐down to “Add Selected Data to Power Map”.
In the Launch Power Map window, select the Power Map with which you wish to work.
76
Excel automatically creates a map from the data in the power pivot model using the country, state, and/or county data within the model.
Click Next.
77
The geography choice is shown at top of Layer pane.
Tables and fields from power pivot model shown below that, with other attributes at bottom.
Clicking ID will add it to the map in the HEIGHT attribute. (see next slide)
78
You can get rid of the overlay by moving your mouse over the overlay and click the X in the upper right corner.
79
Change the Sum to Count
80
You can use the navigation tools to change the perspective of the map.
81
You can even add gender to convert the bars to stacked bars using color.
82
Or even a Choropleth.
83
Power Map ribbon
84
85
86
Left – Power View fields just like in pivot table
Middle – Filters
Right – The “canvas”
87
NOTE: Fields listed in alphabetical order, unlike in pivot table
88
89
But you can convert table into map!
90
Adding Count (Distinct) of ID to SIZE will …
91
… change the map point sizes to be based on the count of people
92
Adding Gender to COLOR will …
93
… change the points to pie charts (YUCK!) showing the gender split!
94
Adding a table for counts of students by college
95
Can add Academic Year to Filters
96
Now, if you select one of the pie charts on the map, say the one in South Carolina you will see …
97
… notice how all the other points are dimmed and the table is filtered to those colleges with students from South Carolina!
98
99
100
101
102
103
104
105
In Excel, select ‘From Other Sources, Facebook’, paste FACEBOOK GROUP ID & select ‘MEMBERS’ in ‘Connection’
106
Expand ‘Object ID’ icon to select additional data elements available (select ‘GENDER’ and ‘USERNAME’)
107
In Excel, select ‘Online Search’, SEARCH TERM: EMPLOYMENT
108
109
110
111
Very similar layout to Excel – Ribbon, Data, Settings/Properties pane
112
Just like an Excel table
Filter data just like in Excel
NOTE: Data shown in filter may be incomplete so using checkboxes may not work
113
Can load directly into Power Pivot from Power Query without loading into an Excel Worksheet!
Be sure to Apply changes!
114
115
116
117