0% found this document useful (0 votes)
121 views32 pages

4 - Data Manipulations

Uploaded by

Santhosh Pa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views32 pages

4 - Data Manipulations

Uploaded by

Santhosh Pa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Chapter 4|Data Manipulations - Exercises

Exercises – Data Manipulations


In Tableau various data manipulation options are available like, sort, filters, sets, custom groups, trend
lines, etc. You can take advantage of all these Tableau Desktop features to ensure responsiveness by
minimizing query complexity, the number of queries, and the size of the results.

Business Scenario
CEO of a Telecom Company wants to analyze their customer data from various perspectives like, by
region, time, age group, etc. Being a data manager, you are asked to create multiple views for customer
data analysis using Tableau Desktop. In this case you can create multiple views by sorting the customer
data by age group, by applying filters on the regions, by adding calculated sets to find top 5 customers,
by creating groups of regions by state, etc.

Exercise 4.1: Sorting

Overview
In this exercise you will perform sorting by various methods:

 Create a view that displays the discount data for all the categories and across all the years.
 Sort this data in descending order for year 2013 using Sort icon.
 Clear the applied sort.
 Once again apply sorting using Sort [Year of Order Date] window, so as to determine which
products and years have the highest average discounts.
 Save workbook as Yearly Category Discount View.
Note: You will perform this exercise using Tableau’s sample data source, Sample – Superstore -English
(Extract).

© 2014, Nice Educons 1


Chapter 4|Data Manipulations - Exercises

The final view should resemble the following image:

Detailed Instructions

Create View

1. On the Home page, under Saved data sources, click Sample - Superstore - English - (Extract).
2. In the Data pane, under Dimensions, locate and drag Order Date to the Columns shelf.
3. In the Data pane, under Dimensions, locate and drag Category to the Rows shelf.
4. In the data pane, under Measures, locate and drag Discount to the Text in the Marks card.

© 2014, Nice Educons 2


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Apply Sorting on Year 2013

5. To sort 2013 data in descending order, hover your mouse over 2013 header and click the sort
icon as shown below:

© 2014, Nice Educons 3


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Clear Sorting

6. To clear the sorting, hover over 2013 header and click the sort icon twice.

On the first click, the sorting order is changed from descending to ascending, while on the
second click the sorting is removed.

Determine products and years that have highest discounts

7. In the Columns shelf, click the YEAR(Order Date) drop-down and select Sort.
8. In the Sort [Year of Order Date] window, under Sort Order, click Descending.
9. In the Sort [Year of Order Date] window, under Sort By, click Field.
10. In the Field drop-down list, select Discount if not already selected.
11. In the Aggregation drop-down list, select Average if not already selected.

© 2014, Nice Educons 4


Chapter 4|Data Manipulations - Exercises

12. Click OK.


13. In the Rows shelf, click the Category drop-down and select Sort.
14. Repeat steps 9 to 13.

© 2014, Nice Educons 5


Chapter 4|Data Manipulations - Exercises

The final view should resemble the following image:

15. On the File menu, select Save.


16. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Yearly Category Discount View.

© 2014, Nice Educons 6


Chapter 4|Data Manipulations - Exercises

Exercise 4.2: Create Groups

Overview
In this exercise, you will create a view to analyze sales for each category:

 Create a group such that Envelops, Labels, and Paper are displayed as a single member.
 Rename the new group created using Edit Alias.
 Observe the combined sales value for this newly created group in the tooltip.
Note: You will perform this exercise using Tableau’s sample data source, Sample – Superstore -English
(Extract).

After grouping the members, the view should resemble the following image:

Detailed Instructions

Create View

1. On the Home page, under Saved data sources, click Sample- Superstore - English (Extract).
2. In the Data pane, under Dimensions, locate and drag Category to the Rows shelf.
3. In the Data pane, under Measures, locate and drag Sales to the Columns shelf.

© 2014, Nice Educons 7


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Save Workbook

4. On the File menu, click Save.


5. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Category Sales View.

© 2014, Nice Educons 8


Chapter 4|Data Manipulations - Exercises

Create Group

6. In the view area, holding CTRL key, select Envelopes, Labels and Paper categories.
7. To create a group, click the paper clip icon on the toolbar and select Category as shown in the
image below:

© 2014, Nice Educons 9


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Alias

8. To create an alias for the Envelopes, Labels, Paper group, right-click the name of the group in
the view, and select Edit Alias as shown in the image below:

9. Type Paper Products in the Edit Alias window’s textbox.

© 2014, Nice Educons 10


Chapter 4|Data Manipulations - Exercises

10. Click OK.

The view should resemble the following image:

Observe Tooltip

11. To view the tooltip, hover over the newly created group mark.
12. Observe the combined sales figure in the tooltip for Paper Products is now $1,353,181.

© 2014, Nice Educons 11


Chapter 4|Data Manipulations - Exercises

The final view should resemble the following image:

(Note: Do not save the changes in Category Sales View and close Tableau)

© 2014, Nice Educons 12


Chapter 4|Data Manipulations - Exercises

Exercise 4.3: Constant Sets

Overview
In this exercise you will:
 Use the Category Sales View workbook.
 Create a set for Chairs & Chairmats, Office Machines, Tables, and Telephones and
Communication categories.
 Apply this set to the category sales view and observe the change in color for categories that are
part of the set and the ones that are excluded.
 Alter this view such that only the members in the set are displayed.

The final view should resemble the following:

Detailed Instructions
1. On the File menu, click Open.
2. In the Open window, select Category Sales View.
3. Click Open.

Create Set

4. Select the mark corresponding to Chairs & Chairmats holding the CTRL key select the marks
corresponding to the Office Machines, Tables, and Telephone and Communication.

© 2014, Nice Educons 13


Chapter 4|Data Manipulations - Exercises

5. Right-click on any of the selected marks and select Create Set as shown below:

© 2014, Nice Educons 14


Chapter 4|Data Manipulations - Exercises

6. In the Create Set window, in the Name box, type High Performing Categories as shown below:

7. Click OK.

Apply Set

8. In the Data pane, under Sets, drag the High Performing Categories set to the view area.

The view should resemble the following image:

© 2014, Nice Educons 15


Chapter 4|Data Manipulations - Exercises

Note: Observe the marks for categories that are part of the set are in color blue, while the rest
are in color grey.

9. To display only the members that are part of the set, in the Marks card, click the IN/OUT (High
Performing Categories) drop-down and select Show Members in Set.

The final view should resemble the following image:

© 2014, Nice Educons 16


Chapter 4|Data Manipulations - Exercises

10. On the File menu, select Save As.


11. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Category Sales View-Constant Sets.

© 2014, Nice Educons 17


Chapter 4|Data Manipulations - Exercises

Exercise 4.4: Filters

Overview
In this exercise, you will use the Category Sales View and apply filters by various methods:

 Apply a filter on the sales header so that only categories having sales above $1000000 are
displayed. Click Undo to return to the previous view.
 Drag and drop the Category measure to the Filters shelf and set the filtering so that the view
displays data only for Bookcases, Envelopes, Paper, and Label categories only. Edit the filter so
that all the categories are displayed.
 Edit the Category filter so as to display categories starting with ‘C’
 Use the Exclude feature to remove the mark for Chairs & Chairmats category.
 You will apply a quick filter to display sales data for categories starting with S.
 Change the quick filter display type to Multiple Values (dropdown) and display data for all
categories except Rubber Bands and Paper.

Detailed Instructions
1. On the File menu, select Open.
2. In the Open window, select Category Sales View.
3. Click Open.

Apply Filter on the Sales

4. In the Columns shelf, click the SUM(Sales) dropdown and select Filter.
5. In the Filter [Sales] widow, click At least.

© 2014, Nice Educons 18


Chapter 4|Data Manipulations - Exercises

6. In the At least box, type 1000000 as shown below:

7. Click OK.
Observe that only categories having sales greater than $1000000 are displayed as shown below:

8. To return to the previous view, click undo on the toolbar.

© 2014, Nice Educons 19


Chapter 4|Data Manipulations - Exercises

Apply Filter on the Categories

9. In the Data pane, under Dimensions, locate and drag Category to the Filters shelf.
10. In the Filter [Category] window, under Select from list, clear the Bookcases, Envelopes, Paper,
and Labels checkbox.
11. Select the Exclude checkbox as shown below:

© 2014, Nice Educons 20


Chapter 4|Data Manipulations - Exercises

12. In the Filter [Category] window, click OK.

Observe that the view displays sales only for Bookcases, Envelopes, Paper, and Labels categories as
shown below:

Edit the Filter

13. To edit the filter, in the Filters shelf, click the Category dropdown and select Filters.
14. In the Filter [Category] window, under Select from list click All.
15. Clear the Exclude checkbox.
16. Click OK.

Display Categories Starting With ‘C’

17. In the Filters shelf, click the Category dropdown and select Filters.
18. In the Filter [Category] window, click the Wildcard tab.
19. On the Wildcard tab, in the Match value box, type C.

© 2014, Nice Educons 21


Chapter 4|Data Manipulations - Exercises

20. Click Starts with as shown below:

21. Click OK.

The view should resemble the following image:

Use Exclude Feature

22. Hover over the mark for the Chairs & Chairmats category such that the tooltip is displayed.
23. In the tooltip, click Exclude.

© 2014, Nice Educons 22


Chapter 4|Data Manipulations - Exercises

This will exclude the mark for Chairs & Chairmats and display data only for Computer Peripherals
and Copiers and Faxes categories as shown below:

Apply Quick Filter

24. In the Filters shelf, click the Category drop down and select Show Quick Filter.

25. In the quick filter for Category box, type S*


26. Press Enter.
The view should resemble the following image:

Note: Observe that the data is displayed only for categories starting with S.

Change the quick filter display type

27. Click the Category quick filter drop-down and select Multiple Values (Dropdown).

© 2014, Nice Educons 23


Chapter 4|Data Manipulations - Exercises

28. In the drop-down list, clear the Rubber Band checkbox.


29. Similarly, clear the Paper checkbox.

The final view should resemble the following image:

13. On the File menu, select Save As.


12. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Category Sales View-Filters.

© 2014, Nice Educons 24


Chapter 4|Data Manipulations - Exercises

Exercise 4.5: Filtering Dates

Overview

In this exercise you will:

 Create a view to display yearly sales.


 Color code the view at quarter level.
 Change the date level from Year to Day.
 Add Trend lines to describe your data.
Note: You will perform this exercise using Tableau’s sample data source, Sample – Superstore -English
(Extract).

Detailed Instructions

Create View

1. On the Home page, under Saved data sources, click Sample-Superstore - English (Extract).
2. In the Data pane, under Dimensions, locate and drag Order Date to the Columns shelf.
3. In the Data pane, under Measures, locate and drag Sales to the Rows shelf.

© 2014, Nice Educons 25


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Color Code the View

4. To color code the view at quarter level, in the Data pane, under Dimensions, drag Order Date to
the Color in the Marks card.
5. In the Marks card, click the Year(Order Date) drop-down and select Quarter.

© 2014, Nice Educons 26


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

Change the level from Year to Day

6. To change the order date level, in the Columns shelf, click the Year(Order Date) drop-down and
select Day.

© 2014, Nice Educons 27


Chapter 4|Data Manipulations - Exercises

The view should resemble the following image:

7. On the File menu, select Save As.


8. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Sales View-Filtering Dates.

© 2014, Nice Educons 28


Chapter 4|Data Manipulations - Exercises

Exercise 4.6: Computed Sets

Overview
In this exercise you will:

 Create and apply a computed set that includes only the top five categories based on their sales.
 Create a category sales report and use this set to highlight the top five performing categories.

Note: You will perform this exercise using Tableau’s sample data source, Sample – Superstore -English
(Extract).

The final view should resemble the following image:

Detailed Instructions

Create View

1. On the Home page, under Saved data sources, Sample -Superstore -English (Extract).
2. In the Data pane, under Measures, locate and drag Sales to the Columns shelf.
3. In the Data pane, under Dimensions, locate and drag Category to the Rows shelf.
4. In the Data pane, under Dimensions, select Category.

© 2014, Nice Educons 29


Chapter 4|Data Manipulations - Exercises

5. Right-click Category and select Create Set as shown below:

6. In the Create Set window, in the Name box type Top 5 Categories.
7. On the General tab, click Use all.

8. Click the Top tab.


9. On the Top tab, select By field.
10. In the first drop-down, select Top.

© 2014, Nice Educons 30


Chapter 4|Data Manipulations - Exercises

11. In the second box, type 5 as shown below:

12. Click OK.


13. In the Data pane, under Sets, locate and drag Top 5 Customers set to the Color in the Marks
card.

© 2014, Nice Educons 31


Chapter 4|Data Manipulations - Exercises

The final view should resemble the following image:

14. On the File menu, select Save As.


15. In the Save As window browse to the Documents\My Tableau Repository\Workbooks and save
workbook as Sales View-Computed Sets.

© 2014, Nice Educons 32

You might also like