Connecting to data in a file

File-based data includes all sources of data where the data is stored in a file. File-based data sources include the following:

  • Extracts: A .hyper or .tde file containing data that was extracted from an original source.
  • Microsoft Access: An .mdb or .accdb database file created in Access.
  • Microsoft Excel: An .xls, .xlsx, or .xlsm spreadsheet created in Excel. Multiple Excel sheets or sub-tables may be joined or unioned together in a single connection.
  • Text file: A delimited text file, most commonly .txt, .csv, or .tab. Multiple text files in a single directory may be joined or unioned together in a single connection.
  • Local cube file: A .cub file that contains multi-dimensional data. These files are typically exported from OLAP databases.
  • Adobe PDF: A .pdf file that may contain tables of data that can be parsed by Tableau.
  • Spatial file: A .kml, .shp, .tab, .mif, or .geojson file that contains spatial objects that can be rendered by Tableau.
  • Statistical file: An .sav, .sas7bdat, .rda, or .rdata file generated by statistical tools, such as SAS or R.
  • JSON file: A .json file that contains data in JSON format.

In addition to those mentioned previously, you can connect to Tableau files to import connections that you have saved in another Tableau workbook (.twb or .twbx). The connection will be imported and changes will only affect the current workbook.

Follow this example to see a connection to an Excel file:

  1. Navigate to the Connect to Excel sheet in the Chapter 02 Starter.twbx workbook.
  2. From the menu, select Data | Create new data source and select Excel from the list of possible connections.
  3. In the open dialogue, open the Superstore.xlsx file from the Learning TableauChapter 02 directory. Tableau will open the Data Source screen. You should see the two sheets of the Excel document listed on the left.
  4. Double-click the Orders sheet and then the Returns sheet. Your data source screen should look similar to the following screenshot:

Take some time to familiarize yourself with the Data Source screen interface, which has the following features (numbered in the preceding screenshot):

  1. Toolbar: The toolbar has a few of the familiar controls, including undo, redo, and save. It also includes the option to refresh the current data source.
  2. Connections: All the connections in the current data source. Click Add to add a new connection to the current data source. This allows you to join data across different connection types. Each connection will be color-coded so that you can distinguish what data is coming from which connection.
  3. Sheets (or Tables): This lists all the tables of data available for a given connection. This includes sheets, sub-tables, and named ranges for Excel; tables, views, and stored procedures for relational databases; and other connection-dependent options, such as New Union or Custom SQL.
  4. Data Source Name: This is the name of the currently selected data source. You may select a different data source using the drop-down arrow next to the database icon. You may click the name of the data source to edit it.
  5. Connection Editor: Drop sheets and tables from the left into this area to make them part of the connection. For many connections, you may add multiple tables that will be joined or unioned together. We'll take a look at some advanced examples of options later in the chapter. For now, notice that you can hover over tables in this space and get options via a drop-down menu.
  6. Live or Extract Options: For many data sources, you may choose whether you would like to have a live connection or an extracted connection. We'll look at these in further detail later in the chapter.
  7. Data Source Filters: You may add filters to the data source. These will be applied at the data-source level, and thus to all views of the data using this data source in the workbook.
  8. Preview Pane Options: These options allow you to specify whether you'd like to see a preview of the data or a list of metadata, and how you would like to preview the data (examples include alias values, hidden fields shown, and how many rows you'd like to preview).
  9. Preview Pane/Metadata View: Depending on your selection in the options, this space either displays a preview of data or a list of all fields with additional metadata. Notice that these views give you a wide array of options, such as changing data types, hiding or renaming fields, and applying various data transformation functions. We'll consider some of these options in this and later chapters.
Once you have created and configured your data source, you may click any sheet to start using it.

Conclude this exercise with the following steps:

  1. Click the data source name to edit the text and rename the data source to Orders and Returns.
  2. Navigate to the Connect to Excel sheet and, using the Orders and Returns data source, create a time series showing Number of Records by Return Reason. Your view should look like the following screenshot:

  1. As the connection you created is based on an inner join of Orders and Returns, this view shows the number of returns for each reason code.

If you need to edit the connection at any time, select Data from the menu, locate your connection, and then select Edit Data Source.... Alternately, you may right-click any data source under the Data tab on the left sidebar and select Edit Data Source..., or click the Data Source tab in the lower-left. You may access the data source screen at any time by clicking the Data Source tab in the lower-left corner of Tableau Desktop.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset