Excel Pivot Tables With Excersises
Excel Pivot Tables With Excersises
Pivot Tables
1 PREFACE 3
1.1 How to use this document 3
1.2 BI4Dynamics 3
2 INTRODUCTION 4
2.1 Understanding dimensions and cubes 4
2.2 General features of BI4Dynamics 4
2.3 Pivot Tables 5
3 CONNECTING TO DATA 6
3.1 Creating a new Connection 6
3.2 Using an existing connection 8
3.3 Changing an existing report connection 9
3.4 Refreshing a connection 10
3.5 Connection properties 10
3.6 Changing language 12
3.7 Exercises 13
4 PIVOT TABLE OVERVIEW 14
4.1 Show fields related to area 14
4.2 Pivot table field list 15
4.3 Pivot table preview 16
4.4 Pivot Table tools tabs 16
5 WORKING WITH PIVOT TABLES 18
5.1 Creating, modifying and deleting the pivot table layout 18
5.2 Nesting dimensions 18
5.3 Exercises 19
6 DATA DISPLAY OPTIONS 22
6.1 Dimension browsing (hierarchies) 22
6.2 Sorting data 22
6.3 Filtering data 23
6.4 Slicers 26
6.5 Search 27
6.6 Subtotals, dimension levels display and grouping 29
6.7 Exercises 30
7 FORMATTING 32
7.1 Pivot table formatting 32
7.2 Displaying and formatting measures 32
7.3 Conditional formatting 33
7.4 Exercises 34
8 CHARTS 39
8.1 Pivot charts vs. Normal charts 39
8.2 Chart design 40
8.3 Chart layout 40
8.4 Chart format 41
8.5 Analyze chart options 41
2
8.6 Sparklines 41
8.7 Exercises 43
9 ADDITIONAL EXERCISES 44
9.1 Sales cube 44
9.2 Inventory cube 47
9.3 General ledger/Account schedules cube 51
3
1 PREFACE
This documents purpose is to empower BI4Dynamics users to fully benefit from BI4Dynamics (as a
source of data) and Microsoft Excel (as a viewing data software). This document is presented in two
parts:
Part 2: Excel exercises for creating your own reports and getting most of BI4Dynamics
As every company has its own needs and challenges BI4Dynamics delivers all you can imagine
content that can be used for analysis. With drag and drop Pivot table functionality you have unlimited
potential of building reports.
1.2 BI4Dynamics
BI4Dynamics is complete Business Intelligence solution that is specially build for Microsoft Dynamics
AX & NAV. BI4Dynamics covers all Microsoft Dynamics AX & NAV application areas and includes
numerous built-in calculations for endless analysis possibilities. F.e. BI4Dynamics NAV Sales module
alone offers 254 measures, 37 dimensions and 137 attributes.
It is open and completely customizable and it also serves as a framework on which you can extend
the solution to fit your needs. Customization Wizard enables building new cubes, modifying built-in
cubes and adjusting setup.
As BI4Dynamics main focus is transforming your data into knowledge by storing your data into Data
Warehouse and creating advanced calculations to empower you with the data and unique version of
the truth that is available to your entire organization. To learn how to use it in best possible way we
created this guide about using Excel Pivot table.
4
2 INTRODUCTION
2.1 Understanding dimensions and cubes
In this chapter, the difference between cubes, dimensions, attributes and hierarchies are presented.
Every cube is composed of different dimensions and different set of measures.
Dimension consists of single attributes that are grouped in predefined hierarchy.
Hierarchies have the possibility to drilldown by levels thus making it easier for the business
to quickly analyze the granular data.
Many attributes are visible and many more are hidden. They can be made visible via the
Bi4Dynamics customization wizard or by modification of properties in Microsoft Analysis
Server (cube).
Example:
Picture: Item Category Group by measures: Stock Quantity, Stock Value, Stock Rotation Days.
Measures can be viewed over different dimensions and their hierarchies or attributes.
BI4Dynamics can join data across any supported version of Microsoft Dynamics NAV database and
company within in one single data warehouse.
Each measure in a specific OLAP cube can be viewed over multiple companies and over eight global
dimensions.
5
Standard measures are in local currency. BI4Dynamics NAV supports by default one additional
currency that is calculated in data warehouse with the information from currency exchange rate data
in Microsoft Dynamics NAV. The measures for additional currencies have an ACY suffix. Measures
with suffix of PCY have values in original currency posted. Such measures should always be analyzed
with dimension Currency to avoid incorrect totals.
Translations for all languages are available in every cube. Users can set-up local connection string (in
Excel) with Locale ID and change the display language in BI client (Excel).
Pivot tables can be seen as a simplification of the more complete and complex OLAP concepts. In
other words they are your best choice when dealing with multidimensional data stored in OLAP
cubes.
The most used tool to work with pivot tables is Microsoft Excel.
6
3 CONNECTING TO DATA
Data is the base of every analysis and we will use Excel to connect to the OLAP cubes, where the data
is stored and prepared for the business user.
OLAP cubes reside on the SQL Analysis Services Server, so in order to get to the data, we first need
to connect to the server.
In Connect to Database Server window write your server name. Choose Windows or User
authentication. Press Next.
7
In Database and Table window choose your database and select designated cube. Press Next.
In Save Data Connection and Finish window choose the file name for your data connection. We
recommend you also fill in Description, Friendly Name and Search Keywords fields. Press Finish.
As an optional last step you can also select where and what you want to create based on this
connection (Pivot Table Report pivot table, Pivot Chart and Pivot Table Report pivot chart and
pivot table, Only Create Connection Create connection, Existing worksheet, New worksheet)
You are now left with a blank pivot table placeholder, pivot table field list and pivot table tools tabs.
Also a new connection file has been created on your file system (by default C:\Users\YOUR
USERNAME\Documents\My Data Sources).
8
Whenever you create a new connection or receive a connection file from someone else, it is available
for you to use, without having to go through the process in the previous step.
For example, your administrator could define the connection, save it on your network and you can
use it create your reports.
Procedure for connecting to OLAP cubes based on an existing connection:
Go to: Data >> Existing Connections
In the next windows you can choose which of the existing connection files you want to use.
9
Once you create a pivot table that pivot table will be associated with a connection. You can always
change the connection the pivot table uses.
Go to: PivotTable Tools >> Change Data Source
Then in the next window click Choose Connection and select the connection you want to use.
10
To refresh the data, you need to refresh the connection which effectively connects to the OLAP cube
and returns the latest data available.
One connection can only be linked to a single OLAP cube. You can however have several connections
in a workbook, though each pivot table can only be based on a single connection.
You can
Refresh individual connections (Refresh) or
Refresh all connections at once (Refresh All).
Go to: Data >> Refresh All (or Refresh)
Each individual connection has several properties you can set. To view the list of all connections in a
workbook go to Data >> Connections, which will bring up the Workbook Connections windows.
11
Besides having the option to also create, delete and refresh individual connections from this window,
you can click on properties button to bring out the properties of the chosen connection.
On the usage tab you can control:
1. The refresh rate of the connection:
Refresh every X minutes
Refresh data when opening the file
2. OLAP Server Formatting for numbers, fonts and colors.
3. OLAP Drill Through which controls the number of records retrieved when performing drill
though (seeing the numbers behind the number).
4. Language settings, which, when available, returns the names of dimensions and measures in
the language of the MS Office.
Table of available languages and locale identifiers. This feature is available on STANDARD version of
Microsoft SQL server.
3.7 Exercises
Top MEASURES
Bottom DIMENSIONS
------------------------------
Sort is alphabetical
16
1. Subtotals turn on/off sum, moving sum in the top or bottom of the table. Sum of selected
dimension values.
2. Grand Totals turn on/off sum total and preview the sum for either column or row values.
Partial sum of all dimension values.
3. Report Layout different report layouts.
4. Blank Rows turn on/off blank rows in dimensions.
5. Row Headers selecting row header color.
6. Column Headers selecting column header color.
7. Banded Rows even rows in other color.
8. Banded Columns even columns in other color.
9. Pivot Table Styles Setting pivot table appearance.
18
5.3 Exercises
We will create a report showing Net Sales by Customer by country over years
Step 1: Drag Customer by country to row labels
Step 2: Drag Date YQMD to columns labels
Step 3: Select Net Sales and see it being added to the Values
20
Use the report you created in exercise 1 (copy the existing report to a new sheet).
Step 1: Drag the date dimension in the filter.
Step 2: Select additional measures: Cost, Profit.
Step 3: Replace customer by country dimension with Bill to customer dimension in row label
Step 4: Which Bill to Customer was the most profitable? HINT: (Sort on Profit from biggest to
smallest)
21
Use the report you created in exercise 1 (copy the existing report to a new sheet).
Step 1: Remove the Customer by Country from the report.
Step 2: Drag Item by Category to rows.
Step 3: Drag Salesperson-Purchaser below Item by Category in rows.
22
We can have filters set on rows and columns at the same time for any dimension present. We will set
up the filter for our date dimension on years 2006 and 2007.
24
If we wish to remove filter, we right click on a dimension value and select Filter >> Clear Filter From
in drop down menu.
We can filter our data to display top X customers, vendors ... To set a Top filter we right click on one
of the countries in our rows and select Filter >> Top 10 from the drop down menu.
In the Top 10 Filter window we control whether we want to select top or bottom members, the
number of members, whether we want to count them as individual items or percentages and by
which measure we want our filter to display. Please note that you can choose any measure in the
OLAP cube, even if it not present in the pivot table.
Value filters are based on the measure values and are set up by right clicking and choosing Filter >>
Value Filters from the drop down menu.
In the Value Filter window we select the measure on which we want to base our filter on, and the
condition for the filter.
25
Report filter is a separate placeholder in the pivot table layout. Only dimensions can be a part of the
report filter. By setting report filter you are filtering all the other measures and dimensions in the
pivot table (in rows, columns and measures).
Report filters appear above the pivot table and you can set a value by clicking on the icon next
to the name.
26
6.4 Slicers
A special kind of report filters introduced in Excel 2010 are Slicers. Slicers offer several advantages
over standard report filters:
They are a much more visual way to present your filters and you can quickly see what you
have filtered on and even indicate where there is no data.
They can be tied to more than one pivot table (if they use the same connection)
They can be formatted, customized and rearranged.
To create a Slicer you can select the pivot table and click Options >> Insert Slicer. This brings up a
window where you can select individual hierarchy levels of dimensions to create desired slicers. Each
level will create a separate slicer.
Slicers
Start from pivot table
27
There is a new Slicer Tools tab available when you select a slicer. This gives you several option to
customize the appearance and behavior of your Slicer.
6.5 Search
Another powerful new feature of Excel 2010 is the Search.
By clicking on the icon you will see the Search box in the dropdown menu. Based on the selected
field of the dimension hierarchy you can search for members by typing in the box. The results are
filtered on-the-fly as you start typing. This is very useful when you want to find a specific member in
a large dimension (for example a specific customer from the customer dimension, or all documents
that start with 011).
28
You can select more options by clicking on button on the right area of search window so that you
can search by different hierarchy levels:
Country
Territory
City
Customer
6.6.1 Subtotals
By default, your pivot table will show Subtotals for various dimension hierarchy levels when you drill
down. We can turn it off by removing the thick in front of Subtotal option in the right-click drop
down menu.
When browsing dimensions, many times pivot tables become too big. In the
example above we browsed to the deepest level of Date YQMD dimension.
We can hide individual level from the hierarchy by right clicking on the field
and select Show/Hide Fields. This can help us in keeping our pivot tables
easier to read and understand. In the below example we hid the quarter and
day level of the Date YQMD dimension.
30
In pivot tables we can group data into custom groups. In our example we will group years 2010 and
2011.
We select the cells for 2010 and 2011 and right click to open the drop down menu. There we select
Group option. This can be also done by clicking pivot table tab Options >> Group >> Group
Selection.
6.7 Exercises
Step 1: Create a new report with Bill-to-Customer in rows, Item by Category in report filters and Net
Sales and Profit % as measures.
Step 2: Set the report filter to Disk Product Group by Searching for DISK (remember to set the
Product Group Level!)
Step 3: Set a TOP 10 display filter by Net Sales
Step 4: Sort the pivot table descending by Profit%
31
7 FORMATTING
7.1 Pivot table formatting
For pivot table formatting we can use all common Excel formatting functions. We can change font
size, colors, cell size, cell color...
Style does not change when we nest dimensions, add new dimensions and refresh data...
We can find all formatting options in Styles toolbar. We can find it in Microsoft Excel >> Home tab.
There is also separate PivotTable Styles section on the Design tab of the pivot table Tools group.
By default measures are shown in the format defined in the OLAP cubes. But, for example, we are
sometimes interested in percentage values rather than the actual values. In this way we can monitor
changing measures throughout a period of time in a more descriptive way. In our example we will
show Gross sales in percentage.
We select the cells we want to format and right click. In the drop down menu we select Value Field
Settings. We can do this also by Options >> Active Field >> Field Settings.
First we have to select the cells we want to add traffic lights to. Then we go to Microsoft Excel >>
Home >> Conditional Formatting >> Icon Sets.
Selected traffic lights are automatically assigned to rows. By default Excel selects a light according to
the averages. If we wish to have our own rules we click More Rules
In Apply Rule To we select the location of the traffic light cells. In Select a Rule Type we select a rule
type. In our case the rule is determined by cell values. In Edit the Rule Description we set up rules for
each light. We click OK.
34
7.4 Exercises
7.4.2 Exercise 2
End result
7.4.3 Exercise 3
Sales/purchaser over multiple measures over customer by county and year 2009 Dec.
Step 1: Create new report on the same sheet.
Step 2: Select Sales/Purchaser dimension and drag it to row label.
Step 3: Drag Net sales, profit, Net sales last YTD to column label.
Step 4: Put Date dimension in the report filter and set filter 2009 Dec.
Step 5: Put Customer by country dimension in report filter and set it for Switzerland.
Step 6: Format numbers.
HINT: You have to format the description of measures to get the same result as in picture.
37
7.4.5 Exercise 5
Trend analysis: Net sales over quarters and years for GB by posting group.
Step 1: Create new report on the same sheet.
Step 2: Drag in Date dimension YMD in row label.
Step 3: Drag in Quarter (separate date dimension under additional fields) in column label.
Step 4: Set up Customer by country in background filter and set it for Great Britain.
Step 5: Show net sales as percentage of row (HINT: Select all measures > right click > value field
settings).
Step 6: Format cells to get the similar result as in the picture.
35,00%
30,00%
25,00% Q1
20,00% Q2
15,00% Q3
Q4
10,00%
5,00%
0,00%
2012 2013 2014 2015
39
8 CHARTS
8.1 Pivot charts vs. Normal charts
Pivot charts are linked with the pivot table. Whatever changes you make in the pivot table are
immediately reflected on the chart and vice versa. Everything in the pivot table is also present on the
chart.
Normal charts on the other hand have to be manually defined and therefore any changes to the
pivot table dont automatically reflect in the chart. Although this can be seen as a downside, it also
gives you a lot more options in customizing your chart independently of the pivot table.
Row labels Displaying fields on a margin Axis fields Displaying fields on chart axis
of the report (Categories)
Column Displaying fields in the top of Legend fields Displaying fields in chart legend
labels the report (Series) labels
Report filter It is used for filtering reports Report filter It is used for filtering reports by
by selected criteria selected criteria
Pivot charts are dynamical structures because pivot tables have that characteristic. Inserting a pivot
chart is very easy. We go to Options >> Tools >> Pivot Chart and Insert Chart window is displayed.
Data is refreshed by clicking Refresh icon in Analyze tab or by right clicking on a cell and selecting
Refresh option in drop down menu.
8.6 Sparklines
Sparklines are a special in-cell chart type introduced in Excel 2010. They are great for showing trends
over time. Because they are in-cell charts, they take very little space and are used to provide a general
overview.
To insert a sparkline, select the data you want to chart and click on the type of sparkline you want to
create on the Insert tab in the ribbon. The types available are:
Line
Column
Win/Loss
You also have to specify the location range, that is, the cells where the sparklines will appear. Note
that you have to select a cell for each series of the sparkline. Multiple series will be grouped together
by default, meaning they share the same characteristics. You can ungroup or group individual
sparklines together as you wish later on.
42
After you create the sparkline another tab with the options to customize your sparkline will be
created in the ribbon.
Edit data allows you to change the data range used to plot the sparklines
Type change the type of the sparkline
Show high and low points, first and last points, negative points or markers for individual
data points
Style - change the style of the sparklines
Sparkline color change the color and thickness of the sparklines
Marker color change the color of individual marker points
Axes customize axis settings
Group & Ungroup allows you to group or ungroup individual sparklines
43
8.7 Exercises
Step 1: Create a report showing Net Sales and Profit % over Years
Step 2: Select the entire data range and Insert a column chart
Step 3: On the layout tab select the Series Profit% from the dropdown menu in current selection
and then click format selection
Step 4: In the new window that open select to plot the series on the secondary axis. Note the change
in you chart.
Step 5: While still having the series selected, right click on it in the chart and select to change the
chart type to line chart.
Step 1: Create a report showing Net Sales of your product categories over individual months
Step 2: Select the entire data range and click on Insert Slicer
Step 3: Select the cells to the right of the pivot table as the location range for the slicers and click OK
Step 4: Make sure all the sparklines use the same minimum and maximum for vertical axis
Step 5: Highlight the Last point with a red bullet
44
9 ADDITIONAL EXERCISES
9.1 Sales cube
9.1.1 Exercise 1
NOTE (Format the chart and add data labels to match the picture)
9.1.2 Exercise 2
9.1.3 Exercise 3
9.1.4 Exercise 4
9.1.5 Exercise 5
9.2.1 Exercise 1
NOTE (Format the chart and add data labels to match the picture)
48
9.2.2 Exercise 2
NOTE (Format the chart and cross table to match the picture)
9.2.3 Exercise 3
9.2.4 Exercise 4
Create new report: Inventory stock value over Item by vendor and over Location for year 2008
NOTE (Format the chart and cross table to match the picture)
9.2.5 Exercise 5
Create new report: Item by vendor (London Postmaster) by location (Silver) for year 2008 over stock
value and stock rotation (days).
NOTE (Format the chart and cross table to match the picture)
50
9.3.1 Exercise 1
Create new report: Balance sheet by multiple measures for Budget v1, year 2009 and company
Cronus 2009
Measures: Net change, debit, credit, Net change last YTD, Net change YTD, Net Change YTD index
Dimensions: GL account by levels, Company, GL Budget, Date YMD
9.3.2 Exercise 2
Create new report: GL account by level over multiple companies in year 2009
9.3.3 Exercise 3
Account Schedules
Create new report: Account schedules PL over Business group for Cronus 2009 in year 2009
9.3.4 Exercise 4