Categories
Uncategorized

Tableau – Overview of Theory

Tableau is data visualization tool used in the business intelligence industry.

Basic concept

Tableau has these data types: number, string, geographic, date, date time, boolean.

Dimensions are a qualitative fields that describe categories of data. Independent values. The pane is created when you have multiple dimensions in a row or column.

Measures are a quantitative or numerical fields, that measure categories of data. Dependent values.

Measure Name is a dimension, that contains a label for each measure in the data source.

Measure Value is a measure that contains numerical values of each measure in the data source.

Latitude and Longitude are generated geo fields, and it is generated when data source contains geographic fields.

Discrete fields – create headers/labels, can be sorted, always represented in blue color.

Continuous fields – create axis, can’t be sorted, always represented in green color.

Aggregation measures are aggregated by default, default aggregation is sum. Measures can have following aggregations: sum, average, median, count, count distinct, minimum, maximum, percentile, std.dev, std.dev (pop.), variance, variance (pop.).

Aggregation and granuality dimensions break down the aggregated total into smaller totals by category. Dimension provides the granuality in a chart.

Aggregating the dimensions – minimum, maximum, count, count distinct. When you aggregate a dimension, it is created a new temporary measure column.

Ratio calculations for example – sum(profit)/sum(sales) sums the profits and sales to whatever the granuality of the view is, and then compoutes the ratio at that aggregation. Profit/Sales computes the profit ratio at the lowest level of granuality then sums the ratios to the requested aggregation of the view.

Basic Chart Types

Bar chart – compare data across categories. Example – sales across different products.

Line Chart – shows trends in data over time. Example – Profit between 2012-2014 as per the order date.

Scatterplot – demonstrate the relationship between measures. Example- relationship between profit and sales.

Maps – two maps types – symbol maps and filled maps. The symbol maps use the symbols to represent a central point of a geographic region whereas in filled pam boundaries of a geographic region is filled with a color.

Combined Axis Chart – is created with one shared axis (X-axis) and two separete axes (Y-axes). Placing measures on the same axis allows you to build a view that compare these measures using one chart.

Dual Axis Chart – compars multiple measures in a graph. Dual axes are two independent axes.

Stacked Bar – is the bar chart with segmented bars.

Crosstab, Highlight table – crosstabs are also known as Text tables. A highlight table encodes a measure on Text and color on Marks card.

Histogram – shows the frequency of distribution. It displays the shape of the distribution.

Categories
tableau

Tableau – Calculated Fields

Calculated fields add data within Tableau, without changing the underlying data.

For example -> Ratio -> sum(x)/sum(y)

  • Fields – for example – gdp, population, location,
  • Functions – sum, min, max, avg
  • Operators – /,+
  • Parameter – variables to replace constant values
  • Comments – //, not displayed in the views

There are many other ways to create different types of calculated fields:

  • using different functions – avg([gdp]),
  • breaking up a data field,
  • combine data fields,
  • or try any other solution.

You can create:

  • calculated strings,
  • calculated dates,
  • logic fields,
  • geographic data.

Calculation Editor

  • open the calculation editor: right-click on a blank space in the Data pane, and select Create Calculated Field. This opens up the calcualtion editor.
  • Calculated field name -> allows you to identify it quickly in the Data pane.
  • On the right -> is a full list of all the functions that Tableau recognizes.
  • Listed functions contains:
    • Syntax – DATENAME(date_part, date, [start_of_week])
    • Function description – Returns a part of given date as a string, where…
    • Example calculation – DATENAME(‘month’, #2022-04-15#) = “April”

String Calculations

  • String data is any data that is text, rather than numbers, dates, or locations.
  • Concatenate strings is put it together.
  • Operator +
  • Example : [City] + ” , ” + [Region]
  • Tableau cannot combine string and integer data.
  • Data needs to be same data type.
  • Tableau is read only, so any change is not written back to the database.
  • Converting data type function:
    • float, int, str
    • STR( [example] )
  • If you want to combine the String and Integer fields. You can concatenate the fields by using the str funtion to convert Integer to matching data type.

Example:

  • Create a calculated field that combines the Customer ID and Customer Name fields:
    • In the Data pane, to the right of Dimensions, click the drop-down arrow, and then click Create Calculated Field.
    • In the top left text box, type “Customer Number & Name”.
    • In the lower left white space, enter this formula:
      • “Customer #” + STR([Customer_ID]) + ” – ” + [Customer Name]
    • Click OK.
  • Add the new field to the view to the left of Customer Name, and adjust so all of the text shows.
    • From Dimensions, drag the Customer Number & Name fields to Rows, and drop it to the left of Customer Name.
    • If a Warning window appears, click Add all members.
    • In the view, adjust the first column’s width by hovering the mouse pointer over the right border of the values under Customer Number & Name, and then click and drag to the right.
    • If you need to, adjust the row height by hovering the mouse pointer over the bottom row border, and then click and drag slightly down.
  • Make sure the new field’s values use this format: “Customer #1887 – Wendy Hobbs”.
  • Remove the original Customer Name field from the view.
    • On Rows, right-click Customer Name, and then click Remove.
    • Note that your row heights may automatically adjust themselves. Re-adjust them if needed.

Date-Specific Calculations

  • calculating difference between dates,
  • adding date
  • using datetime field
  • todo