Session 9-14 Tableau
Session 9-14 Tableau
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
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])
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)
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’
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
Create action to filter everything when the user selects an item from Least Profitable Items
SHEET 2: Also show region-wise performance (discretely) for the latest 6 months
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