Top Banner
Tableau #5: Grouping data, dates/times, box charts Connect to the Superstore data. Grouping data Drag Sub-Category to the Rows shelf. Drag Sales to the Columns shelf. Sort in descending order. This will put Envelopes, Fasteners, and Labels at the bottom. Click on the Envelopes label along the y-axis, then ctrl+click on Fasteners and Labels (also along the y-axis) to select all three. NOTE: You can click on the bars or the labels; it doesn't matter. Right-click on your selection. Click on Group. A label that says Envelopes, Fasteners, Labels will appear and the bars will be combined . The label will change to Desk Supplies and the blue pill in the Rows area now says Sub-Category (group). Right-click on Envelopes, Fasteners, Labels (along the y-axis). Click on Edit Alias…. Enter Desk Supplies for the name. Page 1 of 24
24

Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Sep 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Tableau #5: Grouping data, dates/times, box chartsConnect to the Superstore data.

Grouping dataDrag Sub-Category to the Rows shelf.

Drag Sales to the Columns shelf.

Sort in descending order. This will put Envelopes, Fasteners, and Labels at the bottom.

Click on the Envelopes label along the y-axis, then ctrl+click on Fasteners and Labels (also along the y-axis) to select all three. NOTE: You can click on the bars or the labels; it doesn't matter.

Right-click on your selection. Click on Group. A label that says Envelopes, Fasteners, Labels will appear and the bars will be combined. The label will change to Desk Supplies and the blue pill in the Rows area now says Sub-Category (group).

Right-click on Envelopes, Fasteners, Labels (along the y-axis). Click on Edit Alias….

Enter Desk Supplies for the name.

Page 1 of 23

Page 2: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Creating visual groupsCreate a new worksheet.

Drag Sub-Category to the Rows shelf.

Drag Sales to the Columns shelf.

Sort in descending order. This will put Envelopes, Fasteners, and Labels at the bottom.

Click on the Envelopes bar on the chart. Ctrl-Click on the Fasteners and Labels bars (not the text). They will turn blue and the rest of the bars will become gray.

Click on the Copiers bar on the chart. Ctrl-click on the Appliances bar and the Machines bar. They will turn orange.

At the bottom of the Dimensions area, right-click on Sub-Category (group). Then click on Edit Group.

In the Field Name box, type Office Products.

Below, in the Groups box, click on Appliances, Copiers, Machines to select it. Click on it a second time Type Office Machines over the existing text. Press Enter.

Then (still in the Groups box), click on Envelopes, Fasteners, Labels to select it. Click on it a second time and type Desk Supplies over the existing text. Press Enter.

Click on OK. A legend will appear with the blue and orange bars identified.

Page 2 of 23

Page 3: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Page 3 of 23

Page 4: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

HierarchiesA hierarchy groups several related dimensions together.

Click on Category and then ctrl-click on Sub-Category.

Right-click on either one of the selected dimensions.

Click on Hierarchy. Then click on Create Hierarchy. Name the hierarchy Products.

To add another dimension to the Products hierarchy, right-click on Product Name.

Click on Hierarchy. Then click on Add to Hierarchy. Then click on Products. The Product Name field will be added to the Products hierarchy.

Create a chart using the Products hierarchyDrag Sales to the Columns shelf.

Drag the Products hierarchy to the Rows shelf.

You will get a bar chart with one bar for each category:

Move the mouse over the word Category at the top of the y-axis. The following should appear: a plus sign, an A-Z sort button, and a down-arrow.

Click on the plus sign to reveal the next level in the hierarchy, Sub-Category:

Page 4 of 23

Page 5: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Move the mouse over Sub-Category and click on the plus sign. The third level in the hierarchy (Product Name) will appear:

Page 5 of 23

Page 6: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Date Fields: discrete and continuousContinuous FieldsUse a continuous date field when you want to visualize data over time.

Create a new worksheet.

Drag Sales to the Rows shelf.

Drag Order Date to the Columns shelf. By default, Tableau chooses the largest date unit (Years) and makes a discrete field. We can tell that it is discrete because it is blue.

Let's change it to a continuous field. Click on its down-arrow. The continuous date fields (green) are below the bar, and the discrete date fields (blue) are above the bar. NOTE: there is no difference between a continuous Year field and a discrete Year field (try it). Let's change it to a continuous Quarter field. Click on Quarter Q2 2015.

Page 6 of 23

Page 7: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Your result should look like this:

Page 7 of 23

Page 8: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

It shows each quarter that we have data for.

Now let's change Quarter to Month (continuous). On the Columns shelf, click on the down-arrow next to the QUARTER(Order Date) pill. Click on Month May 2016. This will show each month's sales for each month that we have data for.

Page 8 of 23

Page 9: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Change to Week Number Week 5 2015.

Then change to Day May 8, 2015. This is obviously too much data.

Discrete FieldsDiscrete YearNow let's try some discrete fields. On the Columns shelf, on the Day(Order Date) pill, click its down-arrow. Click on Year 2015 (the first, discrete, occurrence). Your chart will look like this (which is exactly the same as Year 2015 (the second, continuous, occurrence), so it will look exactly the same:

Page 9 of 23

Page 10: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Discrete QuarterNow click on the down-arrow next to YEAR(Order Date) and click on Quarter Q2 (it is the first occurrence of Quarter).

Tableau will now group quarters together, so all of Q1 will be added, all of Q2 will be added, etc., which means we will only have 4 values on the x-axis: Q1 through Q4. Your chart will now look like this:

Page 10 of 23

Page 11: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Or, if you change the chart type to bar (where it will probably be easier to estimate the actual numbers):

It will look like this:

Page 11 of 23

Page 12: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Discrete MonthIn the Columns shelf, on the QUARTER(Order Date) pill, click on the down-arrow and click on Month May. Your chart will look like this:

Page 12 of 23

Page 13: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Discrete DayThis refers to a number from 1-31, not from 1-365, and isn't very meaningful.

Page 13 of 23

Page 14: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Discrete Week NumberThis gives us 52 values, one for each week of the year:

Page 14 of 23

Page 15: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Discrete WeekdayThis gives us 7 values:

Page 15 of 23

Page 16: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Page 16 of 23

Page 17: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Box and whisker Plots

Use box plots, also known as box-and-whisker plots, to show the distribution of values along an axis.

Boxes indicate the middle 50 percent of the data (that is, the middle two quartiles of the data's distribution, from the 25th percentile to the 50th percentile and from the 50th percentile to the 75th percentile).

You can configure lines, called whiskers, to display all points within 1.5 times the interquartile range (in other words, all points within 1.5 times the width of the adjoining box), or all points at the maximum extent of the data, as shown in the following image:

The basic building blocks for a box and whisker plot are as follows:

Mark type: Circle

Columns shelf: Dimension

Rows shelf: Measure

Detail: Dimension

Reference Line: Box Plot

For information on how to add a reference line, see Reference Lines, Bands, Distributions, and Boxes

To create a box plot that shows discounts by region and customer segment, follow these steps:

Page 17 of 23

Page 18: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

1. Connect to the Sample - Superstore data source.

2. Drag the Segment dimension to Columns.

3. Drag the Discount measure to Rows.

Tableau creates a vertical axis and displays a bar chart—the default chart type when there is a dimension on the Columns shelf and a measure on the Rows shelf.

4. Drag the Region dimension to Columns, and drop it to the right of Segment.

Now you have a two-level hierarchy of dimensions from left to right in the view, with regions (listed along the bottom) nested within segments (listed across the top).

5. Click Show Me in the toolbar, then select the box-and-whisker plot chart type.

Tableau displays the a box plot:

Page 18 of 23

Page 19: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

Notice that there are only a few marks in each box plot. Also, Tableau reassigned Region from the Columns shelf to the Marks card. When you changed the chart type to a box plot, Tableau determined what the individual marks in the plot should represent. It determined that the marks should represent regions. We'll change that.

6. Drag Region from the Marks card back to Columns, to the right of Segment.

Page 19 of 23

Page 20: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

The horizontal lines are flattened box plots, which is what happens when box plots are based on a single mark.

Box plots are intended to show a distribution of data, and that can be difficult when data is aggregated, as in the current view.

7. To disaggregate data, select Analysis > Aggregate Measures.

This command turns aggregation on or off, and because data is aggregated by default in Tableau, the first time you select this command, it disaggregates the data.

For more information, see How to Disaggregate Data.

Now, instead of a single mark for each column in the view, you see a range of marks, one for each row in your data source.

Page 20 of 23

Page 21: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

The view now shows the information we want to see. The remaining steps make the view more readable and appealing.

8. Right-click the y axis and select Edit Reference Line.

9. Under Whiskers extend to: select Maximum extend of the data.

10. If you think the dots distract from the data, you can turn on the Hide underlying marks (except outliers) check box.

11. In Edit Reference Line, Band, or Box dialog box, in the Fill drop-down list, select an interesting color scheme.

Page 21 of 23

Page 22: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

For more on these options, see Add a Box Plot in the Reference Lines, Bands, Distributions, and Boxes article.

Now your view is complete:

Page 22 of 23

Page 23: Grouping data - tomkleen.comtomkleen.com/.../Notes/007-Groups,-Dates,-and-Box-Plot…  · Web viewTableau #5: Grouping data, dates/times, box charts. Connect to the Superstore data.

You can see that the discount was the same for all segments in the West. You can also see that the interquartile range (from the 25th percentile to the 75th percentile) for discount was greatest in the Central region for the consumer and corporate segments.

For more information about box plots, see Reference Lines, Bands, Distributions, and Boxes.

Page 23 of 23