0% found this document useful (0 votes)
28 views55 pages

Session 9-14 Tableau

Uploaded by

jay lakhani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views55 pages

Session 9-14 Tableau

Uploaded by

jay lakhani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Introduction

to
Tableau
Tableau: a group of models or motionless figures representing a scene from a story or from history
Tableau Components
Connect to the data
Worksheets:
◦ Contains individual visualizations
Dashboards:
◦ Contains one or more worksheets
Stories:
◦ Combination of worksheets and dashboards
◦ Presentation environment
Create a worksheet
Name a worksheet Integer: Any whole number (i.e. no decimals)
Float: Any number including decimals
Undo/Redo/Clear  Sheet
Tableau Workspace
Data pane: • Cards & Shelves:
◦ Data source
• Columns and Rows shelves
◦ Dimensions
◦ Categorical variables
• Filtering data: Data is excluded
◦ Slicing variables from calculations and other
◦ Measures computations performed on the
◦ Continuous variables summarized data in the table.
◦ Sets • Hiding data: Doesn't display in the
◦ Subset of records view, but it is still included in
◦ Parameters calculations.
Marks card – Key element
Gives visualization detail and context
◦ Allow to modify a view’s design, visualization type, user experience, and
granularity of analysis all in one place
◦ Adding more dimensions/measures  Increased Granularity
Marks Cards: Color, Size, Label, Detail, Tooltip, and Shape.
◦ Allows to “encode” the marks on a view
◦ Encoding marks adds depth to analysis by mapping marks to colors, sizes, and / or
shapes to add context to a view.
◦ Encodings will be carried on to other views as they are created.
Label and Tooltip Marks Cards
Dataset: Hospital visits
1. BAR CHART: Compare the revenue between various departments in the
hospital
1. Arrange it in descending order (SORT)
2. Show only the top 10 departments. (FILTER)  Dept Filter
3. Add Hospital Goal.csv
1. Drag Goal to columns Select Bullet chart
4. Group and highlight some departments
1. Create calculated value: sum(revenue)>= sum(goal)
2. STACKED BAR CHART: Compare the revenue for the year 2019 to the year
2018 for different Department Types
1. Edit colors
2. Group ICU & Natal Together
1. Right-click each bar -- select Mark label-- Always show.
Dataset: Hospital visits
4. CIRCLE CHARTS : Compare doctors within same department in terms of
average minutes to service
Dept Type (rows)- AVERAGE Mins to Serve (Col)
Change x-axis scale – Right clk- Edit axis- Custom -- Fixed start
Slice by Doctors Drop Doctors in Detail card
Drop Department type to color card – Change circle size
Introduce average line for easier comparison
Box-plot
5. HISTOGRAM
◦ Minutes to Service Histogram
◦ Select Minutes to Service -> Select histogram
◦ Creates dimension ‘Minutes to Service (bins)’
◦ Change Bin Size
Dates
Row: Revenue
Column: Year (date of admit)
Built in date hierarchy
Date part: Represents a specific part of the date
Date value: Represent a date value with ref to year
Compare 2018 & 2019 revenue
◦ Use Date Part and slice by year color
◦ Create year lable
Dual Axis chart- Revenue vs No. of patients
Heatmap
Rows: Days
Columns: Month
Detail by Count of patients
Change color
TREE MAPS
◦ Department Type and Department – Rows
◦ Revenue – Column
◦ Click Tree map.
◦ Change color card of Department Type

SCATTER PLOT
Revenue vs No. of patients visit
◦ Slice by Department
◦ Slice with months – Date part & Date Value
Introduction to calculations
Results:
 Per row of data (Row-level calculation)
 At aggregate level
 Level of detail calculations:
 Aggregations that are performed at a specified level of detail, with the results available at the
row level

 Table calculations:
Calculations are performed on the table of aggregate data that has been returned by the data
source to Tableau.
Introduction to calculations
 Calculations will show up as either a new measure or dimension/field
 made up of functions, operations, and references to other fields,
parameters, constants, groups, or sets
Dataset: Vacation Rentals
 Concatenating strings  ‘+’
 Create Full name from First and last name

 Split strings  SPLIT ()


 Create building names and room numbers as separate variables
 Alternate: Transform  custom split

 IF and ELSEIF
 Create the floor number of the rooms as a separate variable “Floor”
IF LEFT([RoomNo],1)= "1" THEN "First Floor" ELSE "Second Floor" END
Aggregate calculations
 Create discount percentage at room level, floor level and property level
 SUM([Discount])/SUM([Rent])
Row-wise sum vs column-wise sum
 AGG indicates that aggregation is defined in the calculation.
 Cannot mix aggregate and non-aggregate arguments with this function
 E.g.: [Discount] / SUM([Rent])

 Change into percentage


 right-click the Discount % -- Default Properties -- Number Format – Percentage

 Display table of Bldg Name- Room No – Rent- Discount – Discount %


 Duration of stay per Guest
Fix “Year” of date field
Concatenate strings  +”-”+”2022”
Convert to date type
 Duration: DateDiff()
Calculate Revenue per Guest
 (((1+([Tax per Night]/100))*[Rent])* [Duration])-[Discount]
 Create Total Revenue at room level, floor level and property level
Table Calculations
 Create a table showing different table
calculations for sales

Quick Calculations
 Running Total: Cumulative total
 Difference
 Rank
 Running Total (Sales) -- Edit Table Calculation – Compute using ‘Pane down’ (starts for every
quarter)
 Difference Total (Sales) -- Edit Table Calculation – Calculation Type – ‘Percent Difference from
quarter)
 Convert the difference quarter-wise : Compute using – Pane down
 YoY Growth rate
LOOKUP(expression, [offset]) : Returns the value of the expression in a target row, specified as a
relative offset from the current row.
 Lookup(ATTR([Category]), -1)
Level of detail (LoD) calculations
 Row Level Expressions and View Level Expressions
 Row Level Expressions: Unaggregated expressions computed for each row
 View Level Expressions: Aggregated expressions computed by the dimensions in the view
 Encloses in AGG function

 LoD Calculations – Defined by calculations


 Aggregations at a specified level of details
 Different from the level of detail that is defined in the view

 FIXED , INCLUDE , and EXCLUDE - keywords indicating type of lod calculation


Dim 1 , Dim 2 – dimensions (more thane one dimension can be included)
 AGG  aggregate function Eg: SUM , AVG , MIN , and MAX
 Field  value that will be aggregated
 FIXED
 Independent of Dimensions in the view

 Returns the average orders per state regardless of dimensions in the view

 INCLUDE
 Aggregates at the level of detail by the dimensions in the view & dimensions in syntax

 EXCLUDE
 Aggregates at the level of detail by the dimensions in the view but excluding any listed in syntax
Create Table – Dept, Category and Sales
◦ Display Total Sales across tables -- {FIXED: SUM([Sales])}
◦ Display Dept-wise Total sales -- {FIXED [Department]: SUM([Sales])}
◦ Calculate percent Sales of individual categories wrt Dept -- ([Sales])/[FxdDept]
Compare “Regional level sales” with the sales of each state in that region
◦ { FIXED [Region]: SUM([Sales])}

 INCLUDE
To perform certain calculations at levels of detail that are lower (more detailed)
than the view level of detail
Display Total Sales across categories & Avg sales per customer in that category
 INCLUDE : {INCLUDE [Customer Name] : SUM([Sales])}
 Add Include – Change Agg to AVERGE Display category-wise SUM(Sales)-

 Display Department-wise sales and average regional-profit for each of the product
categories
 Department Sales  average regional-profit
 ({INCLUDE [Region]: AVG([Profit])})

 EXCLUDE
 Compare the average profit of each department with the overall average profit
 {EXCLUDE [Department]:AVG([Profit])}
Loans.csv
 Each record is a monthly snapshot of a loan
 Was a member ever at risk?: Any member with a credit score of less
than 550 (even once during the payment cycle) is considered to be at
risk.
 Which loan type has the highest numbers of at-risk members?
 Latest balance for a member
 Show the latest balance for each member across loan types
 INCLUDE
What is the average number of loans per member on a state-by-state basis?
 EXCLUDE
 How does the average credit score for a given loan type compare to the overall
average for the entire portfolio?
 Show the difference between the average credit score of a loan type and the
overall average of the portfolio as a bar chart
Scatter Plot & Trend Line
 Predict Sales as a function of Order quantity
 Rows  Sales
 Columns  OQ
 Row Id To disaggregate the data
 Add in Marks pane (label)

 Trendline options – Linear, Logarithmic, polynomial etc…


 Give trend line for each Region
 Describe trend model
 Trend line vs Trend Model
 Interaction Effect: Interaction of Region with Order Qty
 Additional statistical information
 Worksheet  Show summary
 Drop down the menu to show additional details
Trend Lines
 Fields that define X (columns) and Y (rows) coordinates  Independent & Dependent variable
 Row and Column fields to be continuous (green) (Exception: date field)

 Discrete fields  Factors  Can appear on rows/column/shelves


 Used to split trend lines

 Data should be disaggregated at some level for the model


 Predict Sales as a function of Order quantity
Forecasting
 To explore long‐term trends and any potential seasonality
 Data taken over time has random variation
 Smoothing: To cancel the effect due to random variation
 Reveals more clearly the underlying trends.
 Tableau uses exponential smoothing
 Forecast Options
 Forecast Length: Determines how far into the future the forecast extends
 Automatic: Tableau determines the forecast length based on the data.
 Exactly: Extends the forecast for the specified number of units.
 Until: Extends the forecast to the specified point in the future.
Forecasting
 Forecast model:
 Custom:
 No trend & No seasonality - Single Moving Average - straight, flat-line forecast.
 Additive Trend & No Seasonality-
 Multiplicative Trend & No Seasonal
 Integers as periods instead of dates
 Describe Forecast: Summary of forecast
Forecasting
 Additive model: Appropriate if the magnitude of the seasonal fluctuations does not vary with
the level of time series
 Multiplicative model: Used if the seasonal fluctuations increase or decrease proportionally
with increases and decreases in the level of the series.
Clustering
 Clustering – Grouping of individual data points based on the given dimensions
 Data points of a particular cluster are similar to each other based on the dimensions
 Eg: To determine groups of customers related to each other based on spending amounts, frequency
of purchases, or times and days of orders.

 Tableau uses a standard k-means clustering algorithm


 Appropriate only for continuous variables

 Cluster customers with respect to Sales and Profit


 Options for Variables and No. of Clusters
 Materialize the clusters as groups in the data source
 Drag and drop the ‘CLUSTER’ from view pane to data pane
 Assigns a cluster no. for each customer
 Describe Cluster
 Check “Show scaled centres” for easier interpretation
 ANOVA across clusters

 Use Cluster Id on map to see how segments of customers are spread


 Forecast for selected time periods? -- Display Trend line for 1980 to 1988 period
 Use IF-ELSE to break the periods
 Tableau keeps the full date range in the axis for each period.
 Edit Axis  Independent axis range for each row or column
 Receive ”From year” and “To Year” as parameter.
Distribution
Construct a line chart of profit over months
Drag & drop Distribution band – Change to std deviation– band symmetric
Waterfall charts
A waterfall chart is useful when you want to show how parts
successively build up to a whole
 Chart to show how ‘profit’ builds up to a grand total across
‘Departments’ and ‘Categories’ of products
 Rows: Profit
 Quick Table Calculation  Running total (Cumulative total)
 To get a waterfall effect

 Columns: Department & Category


Waterfall charts
 Mark-- Gantt Bar (Change running total back to normal and see)
 Give size to the bars based on Profit
Sort ‘Category’ based on  Profit in ascending order
 Right click x-axis Format Header  Alignment
 Duplicate the sheet
 Step lines and jump lines
 Change Gantt chart to Line
 Change Color of Profit– Path -- Step
Sparklines
 Sparklines are visualizations that use
multiple small line graphs that are
designed to be read and compared quickly
 Give audience the ability to quickly
understand trends – Not exact values
 Category-wise Sales Trend
 Rows – Sales
 Columns – Order Date by Quarter
 Rows- Category
Sparklines
 Add Min Sales, Max Sales values
 Use Calculated field –> Min Sales & Max Sales
Sales Trend- Use Windows_Min/Max
 Change to Discrete
 Identify the last point in the trend
 IF LAST() == 0
 THEN
 SUM([Sales])
 END
 Row: Last Sales
 Dual Axis & Synchronize
 In Marks Enlarge Size of Last Sales
 Remove headers: Right click Y-axis (Sales) – Unclick Show header  Fit Height to view all
Unit/symbol charts
 To show individual items  using shapes or symbols to represent each individual
 Appropriate for discrete/categorical
 Show number of people with “Late Shipping” – Greater than 14 days – Across Region
 Create Calculated field for ‘Late Shipping”
 DATEDIFF("day", [Order Date],[Ship Date]) >14
 Rows: Region
 LOD: Customer Id in Marks
 Move Late Shipping to Filters – Select TRUE
 Marks: Change Automatic – Shape
 Click Shape  Change Shapes
 Do not touch Customer Id
 Increase Size
Unit/symbol charts
 Scatter Plot
 Rows: Sales
 Column: Profit
 Marks: Category

 Pick top 4 categories by Sale


 Filter: Category – Edit filter

 Change Marks: Category -- Shapes


My Tableau Repository\Shapes
 Add figures
Parameters (Parameter values are GLOBAL)
 Placeholder for showing controls
 Steps in creating parameter
 Step 1: Create or define a parameter
 Step 2: Show the parameter as a control option in the view (optional- can
also be used for background calculations)
 Step 3: Create calculated field  How we intend to use the parameter
(optional)
 Parameters by themselves do not do anything.
 Needs to be connected to some other variable/fields/filters etc.
 Step 4: Use
 Ex 1: Create parameter: ‘factor’ that can change values from 0.1 to 1.1 in 0.1 steps
 Create Parameter FACTOR
 Float Current Value
 Range
 0.1 to 1.1 in step size of .1
 Show parameter in View
 Create new variable AdjSales = SUM([Sales]) * [Factor]
 Display across “Categories”

 Ex 2: Create a parameter to search “Customer Name” and display corresponding customers “Sales”
 Parameter: “Enter Cust Name” (string)
 Calculated Field: “Match Cust Name”  CONTAINS(LOWER([Customer Name]),LOWER([Enter Customer
name]))
 Rows: ‘Customer Name’ ; Order Qty
 Move “Match Customer” to Rows  Select Filter ‘TRUE’
Ex 3: Show top ‘N’ customers by ‘Sales’ by getting ‘N’ as user input
 Parameter Creation through “Filter”
 Create Parameter  Enter N & & Show in View
 Drop Customer name (Rows) & Sales (col)
 Connect Parameter to Customer Name filter
 Filter  Top  By Field --.> Select ‘Parameter’

 Ex 4: Construct dynamic Moving Average graph for ‘Sales’:


 Compare sales with different number of moving averages
 moving average 3 units by default (2+current value included)
 Dual Axis -> Synchronize Axis  Helps to make a scaled and correct comparison
Display Moving Average graph for ‘Sales across regions

 Create parameter “Enter MA period”


Drag down SUM (MA SALES) in Rows to “field pane”
 Create new calculated field drag & drop SUM (MA SALES) & replace period with parameter
Plot Date vs New calculated field
Parameters
Ex 5: Show Category-wise sales for each Region – with ‘Region as user input
 Create parameter: Region  List Add values from
 Create Calc Field:”Region-wise sales”
 IF [Region]=[Choose Region] THEN [Sales] END
 Categories (rows) & Region-wise sales (columns)
 Add reference line to show “Avg Sales” across region
 Visualize sales across regions

 Two level bar chart


 Understand sales amounts for departments across various regions
 Create table  Region  Department  Sales
 Color code each department
 Drop Department in Color of Marks

 Sales over time


 Year  Sales  Line chart
 Click ‘+’ sign to drill across quarters & months
 Slice sales over time across regions
 Drop Region over Color card
 Slice sales over time across regions & department
 Drop Department on to rows
Animated visualizations
 Create correlation of Sales and Profit for each Department
 Rows: Profit
 Column: Sales
 Detail: Department
 Shape Mark : Department
 Add Region to Pages
 Show pages

 Switching between Region shows different movement of sales Vs profit


Animated visualizations
 Animations format pane
 Format – Animation
 Sheet –wise Info
Animation : ON
 Duration 2 Second
Animated visualizations
 Animated charts showing Category-wise sales across “Years/Months”
 Column: Sales
 Detail Mark: Category
 Color Mark: Category
 Create Calculated Field – Ranking
 RANK_UNIQUE(SUM([Sales]))
 Move Ranking to Rows
 Right Click Ranking-- Compute Using – “Categories”
 Convert Ranking to Discrete
 Move State to Pages
 And Play
Animated visualizations
 Show Animated time series of monthly sales across regions
 Edit:
 Show History
 Check ALL
 Show Both
Dashboard Building
 Arrangement of individual visualizations
 Each of these visualizations gives you a snapshot of a story within the data
 Insight into the data answers a question or two.

 Bring the snapshots together to communicate a complete and compelling


story to your intended audience
 Types
 Static – Providing visualization of various aspects of the data
 Interactive - allowing users to dynamically filter, drill down, and interact with the data
visualizations

Objectives:
 Telling a story – communicating a narrative with data
Designing dashboards
 Objects - Worksheets, filters, parameters, legends, texts, layout
containers etc
 Tiled versus floating
 Layers of floating objects can be ordered
 Floating object’s size changes with dynamic dashboards
 Hold shift while dragging containers
 Horizontal Vs Vertical Containers:
 Horizontal- resizes according to the width of the objects it contains
 Vertical - adjusts height.
Find which items are the least profitable
 PROFIT BY CATEGORY - Create a bar chart showing profit by Category
 Filter using Department and show a filter
 Sort categories by Profit

PROFIT BY ITEM - Create a bar chart showing profit by Items


 Limit items to only top 10 least profitable ones --- Use Filter

 PROFIT BY STATE - Display a filled map of profit by state


 Drop State in view
 Drop Profit in Color shelf

 Profit by Order date


 Rows: Profit
 Columns: Order date (Quarters)
 Draw Trend line
Actions
 Check -- Use as Filter button on Profit by Category
 Enables view to be used as an interactive filter for the entire dashboard
 When user selects a bar -- all other views will be filtered based on selection

 Create action to filter everything when the user selects an item from Least Profitable Items

 Main menu-- select Dashboard – Actions

 Add Action -- Select Filter

 Set Source Sheets -- Least Profitable Items

 Target Sheets -- Profit by State and Profit Trend

 Action -- set to run on Select.


A regional scorecard dashboard
 SHEET 1: Compare the Region-wise Profit ratio with ‘Target Ratio”
 Provide an option to change ‘Target Ratio”

 SHEET 2: Also show region-wise performance (discretely) for the latest 6 months

 Create a parameter for ‘Target Ratio’

 Create Calculated Field to derive Region-wise Profit Ratio

 Create Calculated Field to compare Region-wise Profit Ratio with Target (KPI)
 IF [Profit ratio]>=[Profit ratio target]
 THEN "Acceptable"
 ELSE "Poor"
 END
 SHEET1: Create Region-map
 Region has to be converted to map
 Apply KPI on Color Shelf

 SHEET 2: Create month-wise performance


 Rows: region (as discrete category)
 Columns: Order date- Month– Discrete
 Filter to top 6 months

 SHEET 3: Show KPI by State

 SHEET 4: Show Profit Ratio by Quarter


 Rows: Profit ratio
 Columns: Order date
 Change Marks to Bar

You might also like