Learning Tableau 10(Second Edition)
上QQ阅读APP看书,第一时间看更新

Connecting to data

Tableau connects to data stored in a wide variety of files and databases. This includes flat files, such as Excel and text files; relational databases, such as SQL Server and Oracle; cloud-based data sources, such as Google Analytics and Amazon Redshift; and OLAP data sources, such as Microsoft Analysis Services. With very few exceptions, the process of building visualizations and performing analysis will be the same no matter what data source you use. We'll cover the details of connecting to different data sources in Chapter 2, Working with Data in Tableau.

For now, we'll connect to a text file, specifically, a comma-separated values file (.csv). The data itself is a variation of the sample data provided with Tableau for Superstore, a fictional retail chain that sells various products to customers across the United States. It's preferable to use the supplied data file instead of the Tableau sample data as the variations will lead to differences in visualizations.

The Chapter 1 workbook, included with the code files bundle, already have connections to the file; however, for this example, we'll walk through the steps of creating a connection in a new workbook:

  1. Open Tableau; you should be able to see the home screen with a list of connection options on the left, thumbnail previews of recently edited workbooks in the center, links to various resources on the right, and sample workbooks on the bottom.
  2. Under Connect and To a file, click Text File.
  3. In the Open dialogue box, navigate to the \Learning Tableau\Chapter 01\ directory and select the Superstore.csv file.
  4. You will now see the data connection screen, which allows you to visually create connections to data sources. We'll examine the features of this screen in detail in the Connecting to data section of Chapter 2, Working with Data in Tableau. For now, notice that Tableau has already added and given a preview of the file for the connection:
  5. For this connection, no other configuration is required, so simply click on the Sheet 1 tab at the bottom to start visualizing the data! You should now see the main work area within Tableau, which looks similar to the following screenshot:

We'll refer to elements of the interface throughout the book using specific terminology, so take a moment to get familiar with the terms used for various components numbered in the preceding image:

  1. The menu contains various menu items for performing a wide range of functions.
  2. The toolbar allows for common functions, such as undo, redo, save, adding a data source, and so on.
  3. The sidebar contains tabs for Data and Analytics. When the Data tab is active, we'll refer to the sidebar as the data pane. When the Analytics tab is active, we'll refer to the sidebar as the analytics pane. We'll go into detail later in this chapter, but for now, note that the data pane shows the data source at the top and contains a list of fields from the data source and is divided into dimensions and measures.
  4. Various shelves, such as Columns, Rows, Pages, and Filters, serve as areas to drag and drop fields from the data pane. The Marks card contains additional shelves, such as Color, Size, Text, Detail, and Tooltip. Tableau will visualize data based on the fields you drop on the shelves.

    Note

    Data fields in the data pane are available to be added to the view. Fields that have been dropped on a shelf are called in the view or active fields, because they play an active role in the way Tableau draws the visualization.

  5. The canvas or view is where Tableau will draw the data visualization. You may also drop fields directly onto the view. In Tableau 10, you'll observe the seamless title at the top of the canvas. By default, it will display the name of the sheet, but it can be either edited or hidden.
  6. Show Me is a feature that allows you to quickly iterate through various types of visualizations based on data fields of interest. We'll look at Show Me towards the end of the chapter.
  7. The tabs at the bottom of the window gives you the option of editing the data source, as well as navigating between and adding any number of sheets, dashboards, or stories. Many times a tab (whether it is a sheet, dashboard, or story) is referred to, generally, as a sheet. We'll also often use these specific terms for a tab:
    • A sheet: A sheet is a single data visualization (such as a bar chart or line graph). Since sheet is also a generic term for any tab, we'll often refer to a sheet as a view because it is a single view of the data.
    • A dashboard: A dashboard is a presentation of any number of related views and other elements (such as text or images) arranged together as a cohesive whole to communicate a message to an audience. Dashboards are often interactive.
    • A story: A story is a collection of dashboards or single views arranged to communicate a narrative from the data. Stories can also be interactive.

    Note

    A Tableau workbook is the collection of data sources, sheets, dashboards, and stories. All of this is saved as a single Tableau workbook file (.twb or.twbx). We'll look at the difference in file types and explore details of what else is saved as a part of a workbook in later chapters.

  8. As you work, the status bar will display important information and details about the view and selections.
  9. Various controls allow you to navigate between sheets, dashboards, and stories, as well as view the tabs as a filmstrip or switch to a Sheet Sorter showing an interactive thumbnail of all sheets in the workbook.

Now that you have worked through connecting to the data, we'll explore some examples that lay the foundation for data visualization and then move into building some foundational visualization types. To prepare for this, do the following:

  1. From the menu, navigate to File | Exit.
  2. When prompted to save changes, select No.
  3. From the \Learning Tableau\Chapter 01 directory, open the file Chapter 01 Starter.twbx. This file contains a connection to the Superstore data file and is designed to help you walk through the examples in this chapter.

Note

The files for each chapter include a Starter workbook that allows you to work through the examples given in this book. If at any time, you'd like to see the completed examples, open the Complete workbook for the chapter.

With a connection to the data, you are now ready to visualize and analyze the data. As you start doing so, you will take on the role of an analyst at the retail chain. You'll ask questions of the data, build visualizations to answer those questions, and ultimately design a dashboard to share the results. Let's start by laying down some foundations to understand how Tableau visualizes data.