• Tidak ada hasil yang ditemukan

Simplifying and Sorting your Data

Dalam dokumen Introduction to Data Visualization (Halaman 56-70)

CYBERTREND DATA ACADEMY

D. Metadata grid

4. Simplifying and Sorting your Data

This module contains the following:

Data Filtering Sorting

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Data Filtering

Using filters narrows the data shown in a view to focus on relevant information. Filters options vary by field type (Dimension, Measure, Date Dimension). After you create a filter, all filtered fields display on the Filters shelf in the worksheet. Use this to identify which ata is included in or excluded from the view.

Filter on a Dimension

The Filter dialog box for dimensions has several filter option tabs.

Filter Option Description

General Shows members of the dimensions you can select for inclusion or exclusion.

Wildcard Sets up a wildcard inclusion or exclusion of members matching the value entered.

Condition Filters values based on specific conditions. Can be determined by fields, range of values, or formula.

Top Filters by top “N”. where N is determined by the value of specified fields or by formula. For example, top 10 cities by Profit. This tab can also be used to show only the bottom N.

These filters are cumulative, meaning the settings you choose on each tab affect the others using

“AND” logic. For example, if you filter Region dimension to include only West (on General tab), and then add conditions for a Top 10 filter (on Top tab), you see Top-10 data for the West only.

Filter on a Dimension in Web

When you drag a dimension from the Data pane to the Filters shelf in web authoring, an interactive filter appears in the view.

You can then select the items you want to include or exclude in the view.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Filter on a Measure

Use measure filters to show only the values that meet your filter criteria. For example, you could apply a filter for Sales that displays only the values above, below, or within a specified range, such as sales greater than $500,000, sales less than $500,000 , or sales between $500,000 and $2,000,000.

Filter Option Description

Range of Values Include all values within the specified range.

At Least Include all values above a specified range.

At Most Include all values below a specified range.

Special Set filter for null or non-null values.

Filter on a Measure in Web

When you drag a measure from the Data pane, to the Filters shelf in web authoring, the field is automatically aggregated as a SUM and an interactive filter appears in the view.

To change the aggregation of the filter:

On the Filters shelf, right-click the field, select Measure, and then select an aggregation.

To change the type of quantitative filter in the view:

Click the filter card drop-down and select from the following:

Range of Values: Select the Range of Values option to specify the minimum and maximum values of the range to include in the view. The values you specify are included in the range.

At Least: Select the At Least option to include all values that are greater than or equal to a specified minimum value. This type of filter is useful when the data changes often so specifying an upper limit may not be possible.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

At Most: Select the At Most option to include all values that are less than or equal to a specified maximum value. This type of filter is useful when the data changes often so specifying a lower limit may not be possible.

Creating Date Filters

Use a date filter to filter a data subset for a specific date or time criteria. You can filters dates for a specific range of dates or for discreate date/time.

Add a Date Filter

1. Drag a date field to the Filters shelf.

2. In the Filter Field dialog box, select the type of date filter you want to use.

Use Relative Dates to update data dynamically with time. For example, set your filter to show data for 3 months before or after the current date. The data shown in your view updates daily.

Use Range of Dates filter to specify a span of time. You can also specify a starting or ending date.

You can create filters for Discreate dates and times like: Years, Quarters, Months, Days, Weekdays, etc.

Discrete Dates & Times

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Creating Date Filter in Web

When you drag a date field from the Data pane to the Filters shelf in web authoring, a date range filter appears in the view.

To change the type of filter, click the filter card drop-down and select from the following:

Relative Date: Click Relative dates to define a range of dates that updates based on the date and time you open the view.

Range of Dates: Select Range of dates to define a fixed range of dates to filter

Start Date: Select Start date to define a fixed start date to filter on.

End Date : Select End date to define a fixed end date to filter on.

Browse Periods: Select browse periods to select a period of time to filter by, such as one day, one week, one month, one year, five years, etc.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Practice: Filtering

You have a view that shows sales data for all of your inventory. Add filters to the view in order to only show information for the selected market and within a range of the sum of sales.

Direction:

1. Open Filtering_Starter.twbx 2. Create Visualization:

❖ From Measure, drag and drop Sales to Rows.

❖ From Dimension, drag and drop Customer Segment and Department to Columns.

❖ From Measure, drag and drop Profit to Color on the Marks card, and change the color palette to Orange Blue Diverging.

3. Create a filter for Region and Show the Filter by click an arrow of the Region on the Filter card, displayed as single value list, removing the All option, and titled “Select a Region”.

4. Create a filter for Sum of Sales, displayed as s slider.

Experiment with the sliders and notice the “AND” logic being used. The results shown are those that match criteria of both filters.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Sorting

Tableau has multiple methods for sorting data in views, including computed sorts and manual sorts.

Computed Sorts

A computed sort sets the sort order option and changes dynamically as the data changes. There are several types of computed sorts.

Sort Description

Default The default sort order determines how a field will be sorted when it is first to a view. You can set the default sort order to either ascending or descending order, as well as control whether it is sorted alphabetically, by data source order, or even by a specified manual sort.

Right-click sorting on a dimension

Performed on dimensions in a visualization, this sort option appears when right-clicking a dimension. This type of sort overrides the default sort, and can sort any aggregation on any data field. It is also dynamic – the sort order is modified as data changes.

One-click sorting on an axis Use the toolbar icons for ascending and descending. Or hover over an axis and click the sorting icon when it appears. This sort overrides the default sort and is dynamic.

Manual Sorts

Manual sorts are an easy way to sort data quickly, but they are not dynamic.

Sort Description

Drag and Drop sorting Apply by dragging headers or labels in a view and dropping them in a new place. This sort is not dynamic (changes in filters or data do not change the sort order) and only applies to the sort field member of a single dimension.

Sorting on selected marks

Click and drag to select the marks in a view that you want to sort, and then hover over the marks and choose the Sort icon that appears in the Tooltip. This sort overrides the default sort and is not dynamic.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

2. Click the sort icon that appears.

One click sorts the data in ascending order. Two clicks sorts it in descending order. Three clicks clears the sort.

The sort will update correctly if the underlying data changes.

Sort specific fields in the viz

To sort a specific field in the visualization:

1. In a worksheet, right-click (control-click on Mac) the field you want to sort and select Sort.

Note: You can only sort dimensions.

2. In the Sort dialog box that opens, do the following:

o For Sort order, select one of the following options:

Ascending - sorts the data in ascending order from lowest to highest or least

to most.

Descending - sorts the data in descending order from highest to lowest or

most to least.

o For Sort by, select one of the following options:

Data source order - the order that the data source naturally orders the data.

Generally for relational data sources, this tends to be in alphabetical order—

more specifically, in natural sort order, which is identical to alphabetical order, except that multi-digit numbers are ordered as a single character. So, for example, in alphabetical sorting, "z11" comes before "z2" because "1" is

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

evaluated as being smaller than "2", whereas in natural sorting "z2" comes before "z11" because "2" is evaluated as being smaller than "11".

If you are using a cube, this order is the defined hierarchal order of the members within a dimension.

Alphabetic - sorts the data alphabetically.

Note: This sort is case sensitive. It will sort [A-Z] before [a-z].

To create a non-case sensitive sort, create a calculated field using the UPPER() or LOWER() functions to transform your strings into a consistent case.

Field - sorts the data based on values in another field. For example, you can

select to sort by the Sales field, using the average aggregation.

Manual - allows you to manually sort the data in the order you prefer. For

example, if you want to sort high school years in order: Freshman, Sophomore, Junior, Senior.

3. When finished, click OK.

The visualization updates with the new sorting.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Sort data using the toolbar

You can quickly sort data in ascending or descending order using the toolbar. To do so:

In a worksheet, on the toolbar located just above the Columns shelf, click the Descending sort icon to sort data from highest/most to lowest/least, or the Ascending icon to sort data from lowest/least to highest/most.

Create a nested sort

With the release of Tableau Desktop 2018.2, you can now create a nested sort without any additional calculated fields or combined dimensions.

Suppose you are looking at sales sub-categories for all regions in your country. In the view below, you can see that the Central region sells more products in the Chairs subcategory than any other subcategory. However it's harder to compare how Chairs ranked in other regions.

To see which subcategories ranked the highest in each region, you might want to sort the subcategories within each region instead. You can do this with nested sorting.

Set up the view

1. In Tableau Desktop, open a new workbook and connect to the Sample Superstore data source that comes with Tableau.

2. Navigate to a new worksheet.

3. From Measures, drag Sales to the Columns shelf.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

5. From Dimensions, drag Sub-Category to the Rows shelf, to the right of the Region field.

Create a nested sort using the header On the worksheet, hover over a viz axis.

Click the sort icon that appears at the top of the view.

One click sorts the data in ascending order. Two clicks sorts it in descending order. Three clicks clears the sort.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Now you have a nested sort where the subcategories are listed in descending order of sum of sales within each region. You can see that Chairs are the highest selling subcategory in the Central region, but in the East region, Phones are the best selling product; Chairs are the second-best selling product.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Practice: Sorting

You currently have a view that shows sales broken down by department and category.

View One

Sort the data in order to make it easier to compare your sales within category. Manually change the order of the department so you can keep an eye on Technology sales.

Open Sorting_Starter.twbx and create a view according to the following specification:

View Two

Starting with a duplicate of the first worksheet, use color and a computed sort to compare the sum of prpofit for the category.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Direction:

1. On the View One :

• Use following steps to create a view :

➢ From Measure, drag Sales to Columns.

➢ From Dimension, drag Department to Rows.

➢ From Dimension, drag Category to Rows (place it to the right of Department).

• Create a manual Default Sort for Department with values ordered by Technology, Office Supplies and Furniture

• Sort Category by SUM(Sales) in descending order.

2. On the View Two:

• Duplicate the View One to create View Two.

• Color encode the bars by Profit by Dragging Profit to Color Marks Card

• Edit the color palette to Red-Green Diverging.

• Edit the sort applied to Category so field selected is sum of Profit.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Dalam dokumen Introduction to Data Visualization (Halaman 56-70)

Dokumen terkait