Session 9-11 Tableau
Session 9-11 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?
{FIXED [Member ID]: MIN([Credit Score])} <550
To Label percentage
Drag member Id into marks – convert to count
Right click—quick table calculation—select percentage
Click compute using—across cell
Loans.csv
Latest balance for a member
Show the latest balance for each member across loan types
Create function to extract latest date
Since one customer has more than one loan type- fix both membered and loan
type
Extract max date : {FIXED [Member ID],[Loan Type]:MAX([Date])}
To extract the Balance corresponding to the date: convert the function to filter
{FIXED [Member ID],[Loan Type]:MAX([Date])}=[Date]
INCLUDE
What is the average number of loans per member on a state-by-state basis?
Draw states across map—draw loanId – convert to count
Cannot find average
Create a syntax for count across members and then find average
{INCLUDE [Member ID] : COUNTD([Loan Number])}
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
Exclude the loan type while calculating the portfolio level average:
{EXCLUDE [Loan Type]: AVG([Credit Score])}