CSE - Data Visualization Lab Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 110

GNITC – SPECIAL BRANCH

GURU NANAK INSTITUTIONS TECHNICAL CAMPUS (AUTONOMOUS)


SCHOOL OF ENGINEERING & TECHNOLOGY

LABORATORY MANUAL

DATA VISUALIZATION- R PROGRAMMING/POWER BI LAB

B.TECH II Year-I Semester

LAB CODE: 22SD0CS01

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

AY: 2024-2025
GNITC – SPECIAL BRANCH

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

LAB MANUAL FOR THE ACADEMIC YEAR 2024-25

LAB : DATA VISUALIZATION- R PROGRAMMING/POWER BI

LAB CODE : 22SD0CS01

YEAR : II

SEMESTER :I

STREAM : CSE

DOCUMENT NO : GNITC -

VENUE :

BLOCK :

PREPARED BY :

VERIFIED BY

HOD – SPECIAL BATCH


GNITC – SPECIAL BRANCH

INDEX

SL.NO. CONTENTS

1. Programme Educational Objectives & Programme Outcomes

2. Department Vision & Mission

3. Lab Objectives

4. Lab Outcomes

5. Evaluation Criteria

6. Introduction about Lab

7. Guidelines to Students

8. List of Experiments

9. Experiments with Solutions


GNITC – SPECIAL BRANCH
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)

PEO 1: Graduates shall have the ability to apply knowledge across the disciplines and in emerging
areas of Computer Science and Engineering for higher studies, research, employability, product
development and handle the realistic problems.

PEO 2: Graduates shall have the ability to apply knowledge across the disciplines and in emerging
areas of Computer Science and Engineering for higher studies, research, employability, product
development and handle the realistic problems.

PEO 3: Graduates shall possess academic excellence with innovative insight, managerial skills,
leadership qualities, knowledge of contemporary issues and understand the need for lifelong learning
for a successful professional career.

PROGRAMME OUTCOMES (POs)

Engineering Graduates will be able to:


1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.

PROGRAMME SPECIFIC OUTCOMES (PSOs)

1. Ability to design, develop, test and debug software applications, evaluate and recognize potential
risks and provide innovative solutions.

2. Explore technical knowledge in diverse areas of Information Technology for upliftment of


society, successful career, entrepreneurship and higher studies.

VISION OF THE DEPARTMENT

To become a premier Computer Science and Engineering department by imparting high quality
education, ethical values, provide creative environment for innovation and global opportunities

MISSION OF THE DEPARTMENT

M1: Nurture young individuals into knowledgeable, skilful and ethical professionals in their pursuit
of Information Technology.
M2: Transform the students through soft skills, excellent teaching learning process and sustain high
performance by innovations.
M3: Extensive partnerships and collaborations with foreign universities to enrich the knowledge and
research.
M4: Develop industry-interaction for innovation and product development to provide good
placements.
Evaluation Criteria
 For practical subjects, there shall be a Continuous Internal Evaluation (CIE) during the semester
for 30 internal marks and 70 marks are assigned for Lab/Practical End Semester Examination
(SEE). Out of the 30 marks for internals, day-to-day work in the laboratory shall be evaluated for
10 marks towards lab report, 10 marks for conduct of experiments and results, 5 marks for viva-
voce will make as one set of marks secured in CIE of lab session. The average of 10 best set of
marks secured by student out of total lab sessions held. Besides, 5 marks towards the final % of
attendance of lab sessions attended by the student in that practical subject.

Allocation of Internal Marks


 Total marks for lab internal are 30 marks.
 Marks distribution is as follows

Lab Report 10 marks


Experiment setup/
10 marks
Program Writing and Execution
Vivavoce 5 marks
% of Attendance 5 marks
Allocation of External Marks
 Total marks for lab External are 70 marks.
 Marks distribution is as follows.
Program Writeup 30 marks
Execution and Result 20 marks
Vivavoce 10 marks
Record 10marks
Introduction about Lab
There are 60 systems installed in this lab. Their configurations are as follows:
 All systems are configured in single mode i.e., Students can boot from Windows XP or Linux as
per their lab requirement.
 This is very useful for students because they are familiar with different operating systems so
that they can execute their programs in different programming environments.
 Software installed: windows operating systems and Linux operating systems and application
software’s like Microsoft office as per the lab requirements.
 Systems are provided for students in the 1:1 ratio.
 Systems are assigned numbers and same system is allotted for students when they do the lab.
Standard Operating Procedure (SOP)
a) Explanation about the experiment by the concerned faculty using PPT covering the following aspects:
1) Name of the experiment/Aim
2) Software/Hardware required
3) Commands with suitable options
4) Test Data
5) Valid data sets
6) Limiting value sets
7) Invalid data sets
b) Writing of shell programs by the students
c) Compiling and execution of the program100 mins.
Write-up in the Observation Book
Observation book format is as follows:

a) Name of the Experiment/Aim


b) Software/Hardware required
c) Commands with suitable options
d) Test Data
1. Valid Data Sets
2. Limiting Value Sets
3. Invalid Data Sets
e) Results for Different Data Sets
f) Viva voice Question and Answers
g) Errors Observed during Compilation and Execution
h) Signature of the Faculty

Guidelines to the Students


Disciplinary to be maintained by the students

 Students are asked to carry their lab observation book and record book.
 Students must use the equipments with care, any damage caused to the equipment by the
student is punishable.
 Students are not allowed to use their cell phones/pendrives/CDs.
 Student need to maintain proper dress code.
 Student are supposed to occupy the systems allotted to them.
 Students are not allowed to make noise in the lab.
 After completion of each experiment student need to update their observation notes and same
to be reflected in the record.
 Lab records needs to be submitted after completion of each experiment and get it corrected
with the concerned lab faculty.
 If a student is absent for any lab, he/she need to complete the experiment in the free time
before attending the next lab.

Steps to perform experiment


 Students have to write the date, aim software and hardware requirements for the experiment in
the observation book.
 Students have to listen and understand the experiment explained by the faculty and note down
the important points in the observation book.
 Students need to write procedure/algorithm in the observation book.
 Student must analyze and develop/implement the logic of the program in the respective
platform.
 After successful execution the results need to be shown to the faculty, and followed by viva
voice.
Instructions to maintain the record
 Weekly updating of the record is a must before the commencement of the next lab session.
 In case the record is lost the student must write all the experiments and inform the same to the
respective faculty.
 Records must be submitted in time, if not their evaluation marks will be deducted.
DATA VISUALIZATION- R PROGRAMMING/POWER BI LAB

COURSE OBJECTIVES

 Effective use of Business Intelligence (BI) technology (Tableau) to apply data visualization.
 To discern patterns and relationships in the data.
 To build Dashboard applications.
 To communicate the results clearly and concisely.
 To be able to work with different formats of datasets

COURSE OUTCOMES
 Understand How to import into Tableau.
 Understand Tableau concepts of Dimensions and Measures.
 Develop Programs and understand how to map Visual Layouts and Graphical Properties.
 Create a Dashboard that links multiple visualizations.
 Use graphical user interfaces to create Frames for providing solutions to real world problems.

S.NO PROGRAM

Understanding Data, What is data, where to find data, Foundations for building Data
1
Visualizations, Creating Your First visualization?
Getting started with Tableau Software using Data file formats, connecting your Data to
2
Tableau, creating basic charts(line, bar charts, Tree maps),Using the Show me panel.
Tableau Calculations, Overview of SUM, AVR, and Aggregate features, Creating
3
custom calculations and fields.
Applying new data calculations to your visualizations, Formatting Visualizations,
4
Formatting Tools and Menus, Formatting specific parts of the view.
Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting Tableau
5
data.
6 Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau data.
Advanced Visualization Tools: Using Filters, Using the Detail panel, using the Size
7 panels, customizing filters, Using and Customizing tooltips, Formatting your data with
colors.
Creating Dashboards & Storytelling, creating your first dashboard and Story, Design
8 For different displays, adding interactivity to your Dashboard, Distributing &
Publishing your Visualization.
Tableau file types, publishing to Tableau Online, Sharing your visualizations, printing,
9
and Exporting.
10 Creating custom charts, cyclical data and circular area charts, Dual Axis charts.

REFERENCE BOOK:
 Microsoft Power BI cookbook, Brett Powell, 2nd edition.
 R Programming for Data Science by Roger D. Peng (References)
 The Art of R Programming by Norman Matloff Cengage Learning India.
1. Understanding Data, What is data, where to find data, Foundations for building Data
Visualizations, Creating Your First visualization?

In our increasingly data-driven world, it’s more important than ever to have accessible ways to
view and understand data. After all, the demand for data skills in employees is steadily
increasing each year. Employees and business owners at every level need to have an
understanding of data and of its impact.
Data visualization is the graphical representation of information and data. By using visual
elements like charts, graphs, and maps, data visualization tools provide an accessible way to see
and understand trends, outliers, and patterns in data. Additionally, it provides an excellent way
for employees or business owners to present data to non-technical audiences without confusion.
In the world of Big Data, data visualization tools and technologies are essential to analyze
massive amounts of information and make data-driven decisions.
Different types of visualizations:

When you think of data visualization, your first thought probably immediately goes to simple bar
graphs or pie charts. While these may be an integral part of visualizing data and a common
baseline for many data graphics, the right visualization must be paired with the right set of
information. Simple graphs are only the tip of the iceberg. There’s a whole selection of
visualization methods to present data in effective and interesting ways.
General Types of Visualizations:

 Chart: Information presented in a tabular, graphical form with data displayed along two
axes. Can be in the form of a graph, diagram, or map. Learn more.
 Table: A set of figures displayed in rows and columns. Learn more.
 Graph: A diagram of points, lines, segments, curves, or areas that represents certain
variables in comparison to each other, usually along two axes at a right angle.
 Geospatial: A visualization that shows data in map form using different shapes and colors
to show the relationship between pieces of data and specific locations. Learn more.
 Infographic: A combination of visuals and words that represent data. Usually uses charts
or diagrams.
 Dashboards: A collection of visualizations and data displayed in one place to help with
analyzing and presenting data. Learn more.

Why data visualization is important?

The importance of data visualization is simple: it helps people see, interact with, and better
understand data. Whether simple or complex, the right visualization can bring everyone on the
same page, regardless of their level of expertise.

While we’ll always wax poetically about data visualization (you’re on the Tableau website, after
all) there are practical, real-life applications that are undeniable. And, since visualization is so
prolific, it’s also one of the most useful professional skills to develop. The better you can convey
your points visually, whether in a dashboard or a slide deck, the better you can leverage that
information. The concept of the citizen data scientist is on the rise. Skill sets are changing to
Accommodate a data-driven world. It is increasingly valuable for professionals to be able to use
data to make decisions and use visuals to tell stories of when data informs the who, what, when,
where, and how.

While traditional education typically draws a distinct line between creative storytelling and
technical analysis, the modern professional world also values those who can cross between the
two: data visualization sits right in the middle of analysis and visual storytelling.
Advantages:

Our eyes are drawn to colors and patterns. We can quickly identify red from blue, and squares
from circles. Our culture is visual, including everything from art and advertisements to TV and
movies. Data visualization is another form of visual art that grabs our interest and keeps our eyes
on the message. When we see a chart, we quickly see trends and outliers. If we can see
something, we internalize it quickly. It’s storytelling with a purpose. If you’ve ever stared at a
massive spreadsheet of data and couldn’t see a trend, you know how much more effective a
visualization can be.

Some other advantages of data visualization include:

 Easily sharing information.


 Interactively explore opportunities.
 Visualize patterns and relationships.
2. Getting started with Tableau Software using Data file formats, connecting your Data to
Tableau, creating basic charts(line, bar charts, Tree maps),Using the Show me panel.
Tableau File Types and Folders:

You can save your work using several different Tableau specific file types: workbooks,
bookmarks, packaged data files, data extracts, and data connection files. Each of these file types
are described below. For related details, see Save Your Work.

 Workbooks (.twb) – Tableau workbook files have the .twb file extension. Workbooks
hold one or more worksheets, plus zero or more dashboards and stories.

 Bookmarks (.tbm) – Tableau bookmark files have the .tbm file extension. Bookmarks
contain a single worksheet and are an easy way to quickly share your work.
 Packaged Workbooks (.twbx) – Tableau packaged workbooks have the .twbx file
extension. A packaged workbook is a single zip file that contains a workbook along with
any supporting local file data and background images. This format is the best way to
package your work for sharing with others who don’t have access to the original data. For
more information, see Packaged Workbooks.

 Extract (.hyper) – Tableau extract files have the .hyper extension. Extract files are a
local copy of a subset or entire data set that you can use to share data with others, when
you need to work offline, and improve performance. For more information, see Extract
Your Data.

 Data Source (.tds) – Tableau data source files have the .tds file extension. Data source
files are shortcuts for quickly connecting to the original data that you use often. Data
source files do not contain the actual data but rather the information necessary to connect
to the actual data as well as any modifications you've made on top of the actual data such
as changing default properties, creating calculated fields, adding groups, and so on. For
more information, see Save Data Sources.

 Packaged Data Source (.tdsx) – Tableau packaged data source files have the .tdsx file
extension. A packaged data source is a zip file that contains the data source file (.tds)
described above as well as any local file data such as extract files (.hyper), text files,
Excel files, Access files, and local cube files. Use this format to create a single file that
you can then share with others who may not have access to the original data stored
locally on your computer. For more information, see Save Data Sources.

These files can be saved in the associated folders in the My Tableau Repository directory, which
is automatically created in your My Documents folder when you install Tableau. Your work files
can also be saved in other locations, such as your desktop or a network directory.
Changing the Repository Location

You can specify a new location for the Tableau repository if you are not using the default
location in your Documents folder. For instance, if you are required to have your data on a
network server instead of on your local machine, you can point Tableau at the remote repository.

1. Select File > Repository Location.

2. Select a new folder that will act as the new repository location in the Select a Repository
dialog box.

3. Restart Tableau so that it uses the new repository.

Changing the repository location does not move the files contained in the original repository.
Instead, Tableau creates a new repository where you can store your files.

Use bar charts to compare data across categories. You create a bar chart by placing a dimension
on the Rows shelf and a measure on the Columns shelf, or vice versa.

A bar chart uses the Bar mark type. Tableau selects this mark type when the data view matches
one of the two field arrangements shown below. You can add additional fields to these shelves.

For more information about the Bar mark type, see Bar mark.

Note: At the end of the procedure is an extra s tep you can take to display totals at the tops of the
bars.
Creates Vertical Bars Creates Horizontal Bars

To create a bar chart that displays total sales over a four-year period, follow these steps:

1. Connect to the Sample - Superstore data source.


Note: In Tableau 2020.2 and later, the Data pane no longer shows Dimensions and
Measures as labels. Fields are listed by table or folder.

2. Drag the Order Date dimension to Columns and drag the Sales measure to Rows.

Notice that the data is aggregated by year and column headers appear. The Sales measure
is aggregated as a sum and an axis is created, while the column headers move to the
bottom of the view. Tableau uses Line as the mark type because you added the date
dimension.
3. On the Marks card, select Bar from the dro-down list
4. The view changes to a bar chart.

The marks (which are bars in this case) are vertical because the axis is vertical. The
length of each mark represents the sum of the sales for that year. The actual numbers you
see here might not match the numbers you see—the sample data changes from time to
time.

5. Drag the Ship Mode dimension to Color on the Marks card.


The view shows how different shipping modes have contributed to total sales over time.
The ratios look consistent from year to year.

6. Drag the Region dimension to Rows, and drop it to the left of Sales to produce multiple
axes for sales by region.

7. To view data in the West region only, you can filter out the other regions. To do this,
drag the Region dimension again, this time from the Data pane to the Filters shel
8. In the Filter [Region] dialog box, clear the Central, East, and South check boxes, and
then click OK.

Build a Treemap
Applies to: Tableau Desktop

Use treemaps to display data in nested rectangles. You use dimensions to define the structure of
the treemap, and measures to define the size or color of the individual rectangles. Treemaps are a
relatively simple data visualization that can provide insight in a visually attractive format.

The basic building blocks for a treemap are as follows:


Mark type: Automatic or Square

Color: Dimension or Measure

Size Measure

Label or Detail: Dimension(s)


To create a treemap that shows aggregated sales totals across a range of product categories,
follow the steps below.

1. Connect to the Sample - Superstore data source.

2. Drag the Sub-Category dimension to Columns.

A horizontal axis appears, which shows product categories.

3. Drag the Sales measure to Rows.

Tableau aggregates the measure as a sum and creates a vertical axis.

Tableau displays a bar chart—the default chart type when there is a dimension on
the Columns shelf and a measure on the Rows shelf.

4. Click Show Me on the toolbar, then select the treemap chart type.

Tableau displays the following treemap:


In this treemap, both the size of the rectangles and their color are determined by the value
of Sales—the greater the sum of sales for each category, the darker and larger its box.

5. Drag the Ship Mode dimension to Color on the Marks card. In the resulting view, Ship
Mode determines the color of the rectangles—and sorts them into four separate areas
accordingly. Sales determines the size of the rectangles:

6. Try another option to modify the treemap: click the Undo button to remove Ship
Mode from view.
7. Drag the Profit measure to Color on the Marks card. Now Profit determines the color of
the rectangles, and Sales determines their size:

With treemaps, Size and Color are the crucial elements. You can place measures
on Size and Color, but placing a measure anywhere else has no effect. Treemaps can
accommodate any number of dimensions, including one or even two on Color. But beyond that,
adding dimensions only breaks the map into an ever greater number of smaller rectangles. For
information on how to place two dimensions on Color in a treemap, see Example – Multiple
Fields on Color.
3. Tableau Calculations, Overview of SUM, AVR, and Aggregate features, Creating custom
calculations and fields.

Aggregate functions allow you to summarize or change the granularity of your data.

For example, you might want to know exactly how many orders your store had for a particular
year. You can use the COUNTD function to summarize the exact number of orders your
company had, and then break the visualization down by year.

The calculation might look something like this:

COUNTD(Order ID)

The visualization might look something like this:

Aggregate functions available in Tableau

Aggregations and floating-point arithmetic: The results of some aggregations may not always
be exactly as expected. For example, you may find that the Sum function returns a value such as
-1.42e-14 for a column of numbers that you know should sum to exactly 0. This happens because
the Institute of Electrical and Electronics Engineers (IEEE) 754 floating-point standard requires
that numbers be stored in binary format, which means that numbers are sometimes rounded at
extremely fine levels of precision. You can eliminate this potential distraction by using the
ROUND function (see Number Functions) or by formatting the number to show fewer decimal
places.
Function Syntax Definition
ATTR ATTR(expre Returns the value of the expression if it has a single value for all
ssi on) rows. Otherwise returns an asterisk. Null values are ignored.
AVG AVG(expres Returns the average of all the values in the expression. AVG can
sio n) be used with numeric fields only. Null values are ignored.
COLLEC COLLECT An aggregate calculation that combines the values in the
T (spatial) argument field. Null values are ignored.

Note: The COLLECT function can only be used with spatial fields.
Example:

COLLECT ([Geometry])
CORR CORR(expr Returns the Pearson correlation coefficient of two expressions.
ess ion
1 The Pearson correlation measures the linear relationship between
, two variables. Results range from -1 to +1 inclusive, where 1
expression2) denotes an exact positive linear relationship, as when a positive
change in one variable implies a positive change of corresponding
magnitude in the other, 0 denotes no linear relationship between the
variance, and −1 is an exact negative relationship.
CORR is available with the following data sources:
 Tableau data extracts (you can create an extract from any data
source)
 Cloudera Hive
 EXASolution
 Firebird (version 3.0 and later)
 Google BigQuery
 Hortonworks Hadoop Hive
 IBM PDA (Netezza)
 Oracle
 PostgreSQL
 Presto
 SybaseIQ
 Teradata
 Vertica

For other data sources, consider either extracting the data or using
WINDOW_CORR. See Table Calculation Functions.

Note: The square of a CORR result is equivalent to the R-Squared


value for a linear trend line model. See Trend Line Model Terms.

Example:

You can use CORR to visualize correlation in a disaggregated


scatter plot. The way to do this is to use a table-scoped level of detail
expression. For example:

{CORR(Sales, Profit)}

With a level of detail expression, the correlation is run over all rows.
If you used a formula like CORR(Sales, Profit) (without the
surrounding brackets to make it a level of detail expression), the
view would show the correlation of each individual point in the
scatter plot with each other point, which is undefined.

See Table-Scoped
COUNT COUNT(ex Returns the number of items in a group. Null values are not counted.
pre ssion)
COUNTD COUNTD(e Returns the number of distinct items in a group. Null values are not
xpr ession) counted. This function is not available in the following cases:
workbooks created before Tableau
Desktop 8.2 that use Microsoft Excel or text file data sources,
workbooks that use the legacy connection, and workbooks that use
Microsoft Access data sources. Extract your data into an extract file
to use this function. See Extract Your Data.
COVAR COVAR(ex Returns the sample covariance of two expressions.
pre ssion
1 Covariance quantifies how two variables change together. A positive
, covariance indicates that the variables tend to move in the same
expression2) direction, as when larger values of one variable tend to correspond to
larger values of the other variable, on average. Sample covariance
uses the number of non-null data points n - 1 to normalize the
covariance calculation, rather than n, which is used by the
population covariance (available with the COVARP function).
Sample covariance is the appropriate choice when the data is a
random sample that is being used to estimate the covariance for a
larger population.
COVAR is available with the following data sources:
 Tableau data extracts (you can create an extract from any data
source)
 Cloudera Hive
 EXASolution
 Firebird (version 3.0 and later)
 Google BigQuery
 Hortonworks Hadoop Hive
 IBM PDA (Netezza)
 Oracle
 PostgreSQL
 Presto
 SybaseIQ
 Teradata
 Vertica

For other data sources, consider either extracting the data or using
WINDOW_COVAR. See Table Calculation Functions.

If expression1 and expression2 are the same—for example,


COVAR([profit], [profit])—COVAR returns a value that indicates
how widely values are distributed.

Note: The value of COVAR(X, X) is equivalent to the value of


VAR(X) and also to the value of STDEV(X)^2.

Example:

The following formula returns the sample covariance of Sales and


Profit.
COVAR([Sales], [Profit])
COVARP COVARP(e Returns the population covariance of two expressions.
xpr ession
1 Covariance quantifies how two variables change together. A positive
, covariance indicates that the variables tend to move in the same
expression2) direction, as when larger values of one variable tend to correspond to
larger values of the other variable, on average. Population
covariance is sample covariance multiplied by (n-1)/n, where n is the
total number of non-null data points. Population covariance is the
appropriate choice when there is data available for all items of
interest as opposed
to when there is only a random subset of items, in which case sample
covariance (with the COVAR function) is appropriate.
COVARP is available with the following data sources:
 Tableau data extracts (you can create an extract from any data
source)
 Cloudera Hive
 EXASolution
 Firebird (version 3.0 and later)
 Google BigQuery
 Hortonworks Hadoop Hive
 IBM PDA (Netezza)
 Oracle
 PostgreSQL
 Presto
 SybaseIQ
 Teradata
 Vertica

For other data sources, consider either extracting the data or using
WINDOW_COVARP. See Table Calculation Functions.

If expression1 and expression2 are the same—for example,


COVARP([profit], [profit])—COVARP returns a value that
indicates how widely values are distributed.

Note: The value of COVARP(X, X) is equivalent to the value of


VARP(X) and also to the value of STDEVP(X)^2.

Example:

The following formula returns the population covariance of Sales and


Profit.

COVARP([Sales], [Profit])
MAX MAX(expre Returns the maximum of an expression across all records. If the
ssion) expression is a string value, this function returns the last value where
last is defined by alphabetical order.
MEDIAN MEDIAN(e Returns the median of an expression across all records. Median can
xpr ession) only be used with numeric fields. Null values are ignored. This
function is not available for workbooks created before Tableau
Desktop 8.2 or that use legacy connections. It is also not available for
connections using any of the following data sources:
 Access
 Amazon Redshift
 Cloudera Hadoop
 HP Vertica
 IBM DB2
 IBM PDA (Netezza)
 Microsoft SQL Server
 MySQL
 SAP HANA
 Teradata

For other data source types, you can extract your data into an extract
file to use this function. See Extract Your Data.
MIN MIN(expres Returns the minimum of an expression across all records. If the
sio n) expression is a string value, this function returns the first value
where first is defined by alphabetical order.
PERCE PERCENTIL Returns the percentile value from the given expression
NT ILE E corresponding to the specified number. The number must be between
(expressio 0 and 1 (inclusive)—for example, 0.66, and must be a numeric
n, constant.
number) This function is available for the following data sources.
 Non-legacy Microsoft Excel and Text File connections.
 Extracts and extract-only data source types (for example,
Google Analytics, OData, or Salesforce).
 Sybase IQ 15.1 and later data sources.
 Oracle 10 and later data sources.
 Cloudera Hive and Hortonworks Hadoop Hive data sources.
 EXASolution 4.2 and later data sources.
For other data source types, you can extract your data into an extract
file to use this function. See Extract Your Data.
STDEV STDEV(exp Returns the statistical standard deviation of all values in the
res sion) given expression based on a sample of the population.
STDEVP STDEVP(e Returns the statistical standard deviation of all values in the
xpr ession) given expression based on a biased population.
SUM SUM(expres Returns the sum of all values in the expression. SUM can be used
sio n) with numeric fields only. Null values are ignored.
VAR VAR(expres Returns the statistical variance of all values in the given expression
sio n) based on a sample of the population.
VARP VARP(expre Returns the statistical variance of all values in the given expression
ssion) on the entire population.
Create an aggregate calculation

Follow along with the steps below to learn how to create an aggregate calculation.

1. In Tableau Desktop, connect to the Sample - Superstore saved data source, which comes
with Tableau.

2. Navigate to a worksheet and select Analysis > Create Calculated Field.

3. In the calculation editor that opens, do the following:

o Name the calculated field Margin.

o Enter the following formula:

IIF(SUM([Sales]) !=0, SUM([Profit])/SUM([Sales]), 0)

Note: You can use the function reference to find and add aggregate functions and
other functions (like the logical IIF function in this example) to the calculation
formula. For more information, see Use the functions reference in the calculation
editor.

o When finished, click OK.

The new aggregate calculation appears under Measures in the Data pane. Just like your
other fields, you can use it in one or more visualizations.

Note: Aggregation calculations are always measures.

When Margin is placed on a shelf or card in the worksheet, its name is changed
to AGG(Margin), which indicates that it is an aggregate calculation and cannot be
aggregated any further.
Rules for aggregate calculations

The rules that apply to aggregate calculations are as follows:

 For any aggregate calculation, you cannot combine an aggregated value and a
disaggregated value. For example, SUM(Price)*[Items] is not a valid expression because
SUM(Price) is aggregated and Items is not. However, SUM(Price*Items) and
SUM(Price)*SUM(Items) are both valid.

 Constant terms in an expression act as aggregated or disaggregated values as appropriate.


For example: SUM(Price*7) and SUM(Price)*7 are both valid expressions.

 All of the functions can be evaluated on aggregated values. However, the arguments to
any given function must either all be aggregated or all disaggregated. For example:
MAX(SUM(Sales),Profit) is not a valid expression because Sales is aggregated and Profit
is not. However, MAX(SUM(Sales),SUM(Profit)) is a valid expression.

 The result of an aggregate calculation is always a measure.

 Like predefined aggregations, aggregate calculations are computed correctly for grand totals. Refer to
Grand Totals for more information.

 Applying new data calculations to your visualizations, Formatting Visualizations, Formatting Tools and
Menus, Formatting specific parts of the view.

Why Use Calculated Fields

Calculated fields allow you to create new data from data that already exists in your data source.
When you create a calculated field, you are essentially creating a new field (or column) in your
data source, the values or members of which are determined by a calculation that you control.
This new calculated field is saved to your data source in Tableau, and can be used to create more
robust visualizations. But don't worry: your original data remains untouched.
You can use calculated fields for many, many reasons. Some examples might include:
 To segment data
 To convert the data type of a field, such as converting a string to a date.
 To aggregate data
 To filter results
 To calculate ratios

Types of calculations

You create calculated fields using calculations. There are three main types of calculations you
can use to create calculated fields in Tableau:

 Basic calculations - Basic calculations allow you to transform values or members at the
data source level of detail (a row-level calculation) or at the visualization level of detail
(an aggregate calculation).

 Level of Detail (LOD) expressions - Just like basic calculations, LOD calculations allow
you to compute values at the data source level and the visualization level. However, LOD
calculations give you even more control on the level of granularity you want to compute.
They can be performed at a more granular level (INCLUDE), a less granular level
(EXCLUDE), or an entirely independent level (FIXED) with respect to the granularity of
the visualization.

 Table calculations - Table calculations allow you to transform values at the level of
detail of the visualization only.

The type of calculation you choose depends on the needs of your analysis and the question you
want to answer.
Create a calculated field

Once you have determined the type of calculation you want to use, it's time to create a calculated
field. This example uses a basic calculation.

Note: The example in this article uses the Sample-Superstore data source that comes with
Tableau Desktop. To follow along with the steps in this article, connect to the Sample-
Superstore saved data source and navigate to Sheet 1.
1. In Tableau, select Analysis > Create Calculated Field.

2. In the Calculation Editor that opens, do the following:

o Enter a name for the calculated field. In this example, the field is called, Discount
Ratio.

o Enter a formula. This example uses the following formula:

IIF([Sales] !=0, [Discount]/[Sales],0)

This formula checks if sales is not equal to zero. If true, it returns the discount
ratio (Discount/Sales); if false, it returns zero.
Tip: To see a list of available functions, click the triangle icon on the right-side

of the Calculation Editor.

Each function includes syntax, a description, and an example for your reference.

Double-click a function in the list to add it to the formula.

For more tips, see Tips for Working with Calculated Fields in Tableau.

3. When finished, click OK.

The new calculated field is added to Measures in the Data pane because it returns a
number. An equal sign (=) appears next to the data type icon. All calculated fields have
equal signs (=) next to them in the Data pane.
Use a calculated field in the view
Step 1: Build the view
1. From Dimensions, drag Region to the Columns shelf.
2. From Dimensions, drag Category to the Rows shelf.
3. On the Rows shelf, click the plus icon (+) on the Category field to drill-down to
Subcategory.
The view updates to look like this:

Step 2: Add the calculated field to the view

1. From Measures, drag Discount Ratio to Color on the Marks card.


You can see that Binders are heavily discounted in the Central region. Notice that
Discount Ratio is automatically aggregated as a sum.

2. On the Rows shelf, right-click SUM(Discount Ratio) and select Measure


(Sum) > Average.

The view updates with the average of discount ratio shown.


Edit a Calculated Field

If at any time you need to change a calculation, you can edit the calculated field and it will
update across your entire workbook.

To edit a calculated field:

1. In the Data pane, right-click the calculated field and select Edit.

2. In the Calculation Editor that opens, you can do the following:

o Edit the name of the calculated field.

o Update the formula.

For this example, the formula is changed to return a discount ratio for orders over
2000 USD in sales:

IIF([Sales] > 2000, [Discount]/[Sales],0)

3. Click OK.

The view updates to reflect the changes automatically. You do not need to re-add the
updated calculated field to the view.

Choosing the right formatting is important to both your analysis and your presentation. You can
change the formatting for almost everything you see on a worksheet, including fonts, shading,
alignment, borders, and graph lines. For example, in a text table, you can add banded shading to
help you visually separate consecutive groups of rows or fields.
In a scatter view with reference lines, you can change the line thickness and color. All of these
settings can be changed using the Format pane. You can specify format settings for the entire
worksheet, all rows, or all fields. You can also format individual parts of the view. For example,
you can format a single field, resize cells and tables, and edit individual axes
Format at the Worksheet Level
Applies to: Tableau Cloud, Tableau Desktop

You can format settings for fonts, alignment, shading, borders, lines and tooltips at the worksheet
level. For example, you might want to remove all the borders in a text table, or add shading to
every other column in a view.

When you make formatting changes at this level, they apply only to the view you're working on.
See Format at the Workbook Level for how to make changes that apply to every view in your
workbook.

Access worksheet formatting settings from Tableau Desktop

Are you formatting your worksheets on the web? See Access worksheet formatting settings from
Tableau Cloud

1. Display a worksheet or dashboard.

2. From the Format menu, choose the part of the view that you want to format, such
as Font, Borders, or Filters.

Format fonts : For a view, you can specify the font, style, size, and color for either the pane
text or header text, or both. For example, in the view below, the header text is set to use the
Tableau Bold font.
If you have totals or grand totals in the view, you can specify special font settings to make these
values stand out from the rest of the data. This is particularly useful when you are working with a
text table. The view below shows a text table in which the grand totals are formatted to be dark
red.

Format text alignment : Tableau uses visual best practices to determine how text is aligned in
a view, but you can also customize text. For example, you can change the direction of
header text so that it is horizontal (normal) instead of vertical (up).
For each text area you can specify the following alignment options:

Horizontal - Controls whether text aligns to the left, right, or center.

Vertical Alignment - Controls whether text aligns at the top, middle, or bottom.

Direction - Rotates text so that it runs horizontally (normal), top-to-bottom (up), or bottom-to-
top (down).

Wrap - Controls whether long headers wrap to the next line or are abbreviated, but does not
control text marks.

Format shading

Shading settings control the background color of the pane and headers for totals, grand totals, as
well as for the worksheet areas outside those areas.

You can also use shading to add banding, alternating color from row to row or column to
column. Banding is useful for text tables because the alternating shading helps your eye
distinguish between consecutive rows or columns.
For row and column banding, you can use the following options:

Pane and Header- The color the bands use.

Band Size - The thickness of the bands.

Level - If you have nested tables with multiple fields on the rows and columns shelves, this
option allows you to add banding at a particular level.

Format borders

Borders are the lines that surround the table, pane, cells, and headers in a view. You can specify
the border style, width, and color for the cell, pane, and header areas. Additionally, you can
format the row and column dividers. For example, in this view the Row Divider borders are
formatted to use an orange color:
Row and column dividers serve to visually break up a view and are most commonly used in
nested text tables. You can modify the style, width, color, and level of the borders that divide
each row or each column using the row and column divider drop-downs. The level refers to the
header level you want to divide by.

Format lines

You can control the appearance of the lines that are part of the view, such as grid lines and zero
lines, as well as lines that help you inspect data, such as trend lines, reference lines, and drop
lines.

For example, you can set trend lines to use a red color and an increased thickness:

Format highlighters
The highlighter on your worksheet can be formatted to use a different font, style, color,
background color, font size, and border. Formatting highlighters allows you to better integrate
them into your dashboard or worksheet style. You can also edit the title that displays on each
highlighter that shows in the view.

For more information about using highlighters, see Highlight Data Points in Context.

Format a filter card

Filter cards contain controls that let users interact with your view. You can change filter cards to
use custom formatting. For example, the body text in the filters below is formatted to use the
Tableau Bold font, in aqua.

Format a parameter control card

Parameter controls are similar to filter cards in that they contain controls that let users modify the
view. If you create a parameter control, you can customize how it looks. For example, in the
view below, the Sales Range parameter is formatted so that the sales amount appears in orange.
Copy and paste worksheet formatting (Tableau Desktop only)
After you format a worksheet, you can copy its formatting settings and paste them into other
worksheets. The settings that you can copy are anything you can set in the Format pane, with
the exception of reference lines and annotations. Adjustments like manual sizing and level of
zoom are not copied.
1. Select the worksheet from which you want to copy formatting.
2. Right-click (control-click on Mac) the worksheet tab and select Copy Formatting.
3. Select the worksheet you want to paste the formatting into.
4. Right-click (control-click on Mac) the worksheet tab and select Paste Formatting.
Access worksheet formatting settings from Tableau Cloud
Are you formatting your worksheets on Tableau Desktop? See Access worksheet formatting
settings from Tableau Desktop.
1. Display a worksheet.
2. From the toolbar, click Format > Worksheet, and then choose the part of the view that
you want to format, such as Font, Lines, or Borders and Dividers.

Format fonts

For a view, you can specify the font, style, size, and color for your text. In this example, the text
is set to use the Tableau Bold font.
Rotate labels

Tableau uses visual best practices to determine how label text is aligned in a view, but you can
also customize your alignment. For example, you can change the direction of label text so that
it’s horizontal (left to right) or vertical (up and down).

To rotate your labels, right-click (control-click on Mac) on a label and select Rotate Labels.

Note: Tableau adheres to regional standards when determining when to begin or end line breaks.
Format shading

Shading settings control the background color of the worksheet, pane, and headers.

To access these settings, to go Format > Worksheet > Shading.

You can also add banding, alternating color from row to row or column to column. Banding is
useful for text tables because the alternating shading helps your eye distinguish between
consecutive rows or columns.
For row and column banding, you can use the following options:

Pane and Header- The color the bands use.

Band Size - The thickness of the bands.

Level - If you have nested tables with multiple fields on the rows and columns shelves, this
option allows you to add banding at a particular level.

Format lines

You can control the appearance of the lines that are part of the view, such as grid lines and zero
lines. You can turn the lines on or off and format the line type (for example, solid, dotted, or
dashed) and the thickness of the times. You can also format the color and the opacity of the lines.

For example, you can turn on grid lines to help give quantitative cues to the viewer. In this
example, gray dotted grid lines have been added to the viz.

You can also format trend lines, reference lines, and reference bands on the web. You can access
these formatting settings by clicking the tooltip on the line, or by clicking on the line while the
format pane is open. In this example, the trend line has been formatted to be a solid green line.
Format interactive controls

You can format all of your interactive controls, including legends, filters, highlighters, and
parameters at the same time using the Interactive Controls section of the worksheet format pane.

To access these settings, go to Format > Worksheet > Interactive Controls.

If you'd like these controls to have consistent formatting, formatting at this level will save you
time.Alternatively, you can format each interactive control individually.

Format legends: If you have a legend on your worksheet, you can customize how it looks. For
example, in this example, the Sales above Budget legend is formatted so that the title is bolded
and the background is light gray.

You can access legends formatting by either going into Format > Legends, or by clicking into
the menu on the legend and selecting Format Legends. You can also edit the colors for each of
the items in the legend, edit the title, or choose to hide the title or legend through this menu.

Format filters

Filter cards contain controls that let users interact with your view. You can change filter cards to
use custom formatting. For example, the body text in the filter shown is set to Tableau Medium,
the title text is set to Tableau Semibold, the background is set to green with 50% opacity, and a
black border has been added.

You can access Filters and Sets formatting by either going into Format > Filters and Sets, or by
clicking into the menu on the Filter card and selecting Format Filters and Sets.
Format highlighters

The highlighter on your worksheet can be formatted to customize your font, background color,
and border. Formatting highlighters allows you to better integrate them into your dashboard or
worksheet style. You can also edit the title that displays on each highlighter that shows in the
view.
You can access highlighter formatting by either going into Format > Highlighters, or by
clicking into the menu on the Highlighter card and selecting Format Highlighters.

For more information about using highlighters, see Highlight Data Points in Context
Format parameters

Parameter controls are similar to filter cards in that they contain controls that let users modify the
view. If you create a parameter control, you can customize how it looks. For example, in the
view below, the New Business Growth parameter is formatted so that the growth percentage text
appears in green.

You can access Parameters formatting by either going into Format > Parameters, or by clicking
into the menu on the parameter card and selecting Format Parameters.
Format borders and dividers

Borders are the lines that surround the table, pane, and headers in a view. You can specify the
border style, width, and color for the pane and header areas. Additionally, you can format the
row and column dividers. For example, in this view the Row Divider borders are formatted to
use a blue color.

Row and column dividers serve to visually break up a view and are most commonly used in
nested text tables. You can modify the style, width, color, and level of the borders that divide
each row or each column using the row and column divider drop-downs.

By default, the Pane and Header dividers are formatted simultaneously to save you time. If you'd
like the pane and the headers to have different formatting, click the link icon to unlink the
formatting and format each member separately.

You can also switch the formatting settings for Row and Column Dividers on or off to hide
styling options you don't want to use. In this example, Row Dividers formatting is turned off, and
the Column Dividers pane and header formatting is unlinked.

Row and column divider level settings

The level refers to the header level you want to divide by. For example, if you have two fields on
your measures column, such as category and sub-category, you can choose to have row dividers
just by category (level 1) or by category and sub-category (level 2).

In this example, the row divider is set at level 2.


5. Editing and Formatting Axes, Manipulating Data in Tableau data, Pivoting Tableau
data.

When you add a continuous field (a field with a green background) to the Columns or Rows
shelf, it adds an axis to the view. An axis shows data points that lie within a range of values. For
each axis, you can specify the range, scale, and tick mark properties.

Double-click an axis to open the Edit Axis dialog box and change the axis configuration and
formatting. If you can't edit the axis, see Why can't I edit my axis?

In this example, the Profit field (a continuous measure) on the Rows shelf creates a vertical axis,
and the Order Date field (a continuous date dimension) on the Columns shelf creates a
horizontal axis.

Edit an axis range

To edit an axis range, double-click the axis that you want to edit.
When you select an axis, the marks associated with the axis are not selected so that you can edit
and format the axis without modifying the marks.

To select the marks associated with the axis, right-click the axis and select Select Marks. You
can also select each mark individually. For more information, see Select marks(Link opens in a
new window).

Why can't I edit my axis?

If you can't edit an axis, it's most likely a header rather than axis.

 Continuous fields (green background) on the Rows and Columns shelves create axes in
the view. When you right-click an axis, you will see this menu:

 Discrete fields (blue background) on the Rows and Columns shelves create headers, not
axes. When you right-click a header, you will see this menu:
You can edit the formatting of headers by right-clicking a header, and then selecting Format.

For more details on formatting headers and field labels, see Format at the Worksheet
Level and Format Fields and Field Labels. For details on continuous and discrete fields,
see Dimensions and Measures, Blue and Green.

Hide and reshow axes and headers

If you have hidden an axis or a header in the view, you can show it again from its related field in
the view.

To hide an axis

Right-click (control-click on Mac) the axis in the view, and then clear the check mark next to
the Show Header option.

To show a previously hidden axis

Right-click (control-click on Mac) the continuous field in the view that is associated with axis
you want to show, click its drop down menu, and then click Show Header.

Change an axis range

You can limit the axis range to focus the view on certain data points.

For example, assume your view shows sales over four years. The automatic axis might show a
range from 0 to $750,000. If sales never go below $470,000, you can adjust the axis range to
start at $470,000 to keep the focus on where the data points actually lie.

To change an axis range:


1. Double-click the axis that you want to edit. You can also right-click (control-click on
Mac) the axis, and then select Edit Axis.

2. In the Edit Axis dialog box, select one of the following options:

o Automatic.Automatically bases the axis range on the data used in the view.

o Uniform axis range for all rows or columns.Sets the axis range uniformly to the
maximum data range for all panes in the view.

o Independent axis ranges for each row or column. Makes the axis range
independent. The axis range varies for each pane in the view, depending on the
range of data in each pane.

o Fixed. Specifies to start and/or end the axis at a specific value. You can fix both
ends of the axis or only one end. When you fix both ends of the axis, the axis
range is determined by the values you specify. When you fix only one end of the
axis, you must set the other end of the axis as automatic, uniform, or independent.

3. You can also specify whether to include zero. When you clear the Include zero check
box, the axis range adjusts to show only the range of values in the data.

4. Click OK.
Change the axis scale to reversed or logarithmic

Axis scale options include Reversed and Logarithmic.

When you select Logarithmic, you can then specify Positive or Symmetric. Symmetric displays
data that contains positive, 0, or negative values on a log scale axis, and is best used to visualize
large negative values on a logarithmic scale, as well as large positive values, or both. For related
details, see About the symmetric log axis transform.
To change the scale of an axis:
1. Double-click the axis that you want to edit. You can also right-click (control-click on
Mac) the axis, and then select Edit Axis.
2. In the Edit Axis dialog box, on the General tab, select Reversed or Logarithmic for the
axis scale.
The option to choose Symmetric or Positive is only available when the axis range extends
outside of the closed interval [-10, 10].
Logarithmic: Select Positive or Symmetric for the log scale. The Symmetric option
displays data that contains positive, 0, and negative values on a log scale axis. By default,
the tick marks are drawn at powers of ten, but you can specify any base that is greater

than 1.

3. Click the Tick Marks tab and select one of the following options:

o Automatic - the major tick marks are drawn at powers of 10.

o Fixed - the major tick marks are drawn at a specified exponent. Type a number
into the Powers of text box.

o None - major tick marks are not shown.


4. When finished, click OK.
Pivot Data from Columns to Rows

Sometimes, analyzing data that is stored in a crosstab format can be difficult in Tableau. When
working with Microsoft Excel, text file, Google Sheets, and .pdf data sources, you can pivot your
data from crosstab format into columnar format. If you are working with other data sources, you
can Pivot using custom SQL (Tableau Desktop).

Pivot the data

After you have set up the data source, in the grid, select two or more columns. Click the drop-
down arrow next to the column name, and then select Pivot. New columns called "Pivot field
names" and "Pivot field values" are created and added to the data source. The new columns
replace the original columns that you selected to create the pivot.
Add to the pivot

To add more data to the pivot, select another column, click the drop-down arrow next to the
column name, and then select Add Data to Pivot. Make sure that the pivot columns and values
look as expected before you begin your analysis.

To remove a pivot, click the drop-down arrow next to the name of a pivot column, and then
select Remove Pivot.
Troubleshooting pivots

 Red fields in the view and fields with exclamation points in the Data pane: Because
the original fields are replaced with new pivot fields, any references to the original fields
in the view will no longer work. They cause fields to become red in the view or show a
red exclamation point next to the field in the Data pane.

 Null values in the grid: If all of the original fields used in the pivot are removed, for
example in an extract refresh, null values display in the pivot fields.

 No pivot option: Pivot appears when you select two or more columns in a single
Microsoft Excel, text file, Google Sheets, and .pdf data source. If using a different data
source in Tableau Desktop, you can use custom SQL to pivot.
Pivot using custom SQL (Tableau Desktop)

You can also use custom SQL to pivot your data, even if you aren't working Excel, text file,
Google Sheets, and .pdf data sources. When you use the UNION ALL operator in a custom SQL
query, you can take values from distinct columns and put them into a new column.

For example, suppose you have a table called Contest.


Contest
Runner Start Time End Time
Amanda 9/3/2016 3:04 PM 9/3/2016 3:25 PM
Oscar 9/3/2016 3:04 PM 9/3/2016 3:21 PM
William 9/3/2016 3:04 PM 9/3/2016 3:16 PM

To optimize your analysis of this data in Tableau, you can use the following custom SQL query
to pivot the "Start Time" and "End Time" columns so that their values are in a single column.
Select [Runner]
, 'Start' as [Action]
, [Start Time] as [Time]
From [Contest]
Union ALL
Select [Runner]
, 'End' as [Action]
, [End Time] as [Time]
From [Contest]

The above custom SQL query does the following:

 Pivots the Start Time column header into a string value called Start and adds that value
to a new column called Action.

 Pivots the End Time column header into a string value called End and adds that value to
a new column called Action.

 Pivots the Start Time and End Time columns so that their values are in a new column
called Time.

The following table shows the results of this custom SQL query.
Runner Action Time

Amanda Start 9/3/2016 3:04 PM

Oscar Start 9/3/2016 3:04 PM

William Start 9/3/2016 3:04 PM

Amanda End 9/3/2016 3:25 PM


Runner Action Time

Oscar End 9/3/2016 3:21 PM

William End 9/3/2016 3:16 PM

To pivot data using custom SQL

1. Connect to your data.

2. Double-click the New Custom SQL option in the left pane. For more information,
see Connect to a Custom SQL Query.

3. In the Edit Custom SQL dialog box, copy and paste the following custom SQL query
and replace the contents with information about your table:
Select [Static Column]
, 'New Value (from Column Header 1)' as [New Column Header]
, [Pivot Column Values 1] as [New Values]
From [Table]
Union ALL
Select [Static Column]
, 'New Value (from Column Header 2' as [New Column Header]
, [Pivot Column Values 2] as [New Values]
From [Table]
Union ALL
Select [Static Column]
, 'New Value (from Column Header 3' as [New Column Header]
, [Pivot Column Values 3] as [New Values]
From [Table]

Where the following is true:

o Static Column: A comma-delimited list of the columns from Table, both


dimensions and measures, which should not be included in the pivot.

o New Value (from Column Header 1-3): New names that you give to the original
column headers, which are used as row values in the pivot.

o Pivot Column Values 1-3: The columns whose values need to be pivoted into a
single column.

o New Column Header: The name you give the new column that contains the new
row values from New Value (from Column Header 1-3).
o New Values: The name give the new column that contains the original values
from Pivot Column Values 1-3.

o Table: The table that you connected to.

4. Click OK.

6. Structuring your data, Sorting and filtering Tableau data, Pivoting Tableau data.

The structure of your data may not be something you can control. The rest of this topic assumes
you have access to the raw data and the tools needed to shape it, such as Tableau Prep Builder.
However, there may be situations when you can't pivot or aggregate your data as desired. It is
often still possible to perform the analysis but you may need to change your calculations or how
you approach the data. For an example of how to perform the same analysis with different data
structures, see Tableau Prep Day in the Life Scenarios: Analysis with the Second Date in
Tableau Desktop(Link opens in a new window). But if you can optimize the data structure it will
likely make your analysis much easier.

Data Structure

Tableau Desktop works best with data that is in tables formatted like a spreadsheet. That is, data
stored in rows and columns, with column headers in the first row. So what should be a row or
column?

What is a row?

A row, or record, can be anything from information around a transaction at a retail store, to
weather measurements at a specific location, or stats about a social media post.

It's important to know what a record (row) in the data represents. This is the granularity of the
data.
Here, each record is a day Here, each record is a month
Tip:A best practice is to have a unique identifier (UID), a value that identifies each row as a
unique piece of data. Think of it like the social security number or URL of each record. In
Superstore, that would be Row ID. Note that not all data sets have a UID but it can't hurt to have
one.

Try to make sure you can answer the question "What does a row in the data set represent?". This
is the same as answering "What does the TableName(Count) field represent?". If you can't
articulate that, the data might be structured poorly for analysis.
Aggregation and Granularity

A column of data in a table comes into Tableau Desktop as a field in the data pane, but they are
essentially interchangeable terms. (We save the term column in Tableau Desktop for use in the
columns and rows shelf and to describe certain visualizations.) A field of data should contain
items that can be grouped into a larger relationship. The items themselves are
called values or members (only discrete dimensions contain members).

What values are allowed in a given field are determined by the domain of the field (see the note
below). For example, a column for "grocery store departments" might contain the members
"deli" "bakery", "produce", etc., but it wouldn't include "bread" or "salami" because those are
items, not departments. Phrased another way, the domain of the department field is limited to just
the possible grocery store departments.

Additionally, a well-structured data set would have a column for "Sales" and a column for
"Profit", not a single column for "Money", because profit is a separate concept from sales.

 The domain of the Sales field would be values ≥ 0, since sales cannot be negative.

 The domain of the Profit field, however, would be all values, since profit can be negative.

Note: Domain can also mean the values present in the data. If the column "grocery store
department" erroneously contained "salami", by this definition, that value would be in the
domain of the column. The definitions are slightly contradictory. One is the values that could or
should be there, the other is values that actually are there
Categorizing fields

Each column in the data table comes into Tableau Desktop as a field, which appears in
the Data pane. Fields in Tableau Desktop must be either a dimension or measure (separated by a
line within tables in the Data pane) and either discrete or continuous (color coded: blue fields are
discrete and green fields are continuous).

 Dimensions are qualitative, meaning they can't be measured but are instead described.
Dimensions are often things like city or country, eye color, category, team name, etc.
Dimensions are usually discrete.

 Measures are quantitative, meaning they can be measured and recorded with numbers.
Measures can be things like sales, height, clicks, etc. In Tableau Desktop, measures are
automatically aggregated; the default aggregation is SUM. Measures are usually
continuous.

 Discrete means individually separate or distinct. Toyota is distinct from Mazda. In


Tableau Desktop, discrete values come into the view as a label and they create panes.

 Continuous means forming an unbroken, continuous whole. 7 is followed by 8 and then


it's the same distance to 9, and 7.5 would fall midway between 7 and 8. In Tableau
Desktop, continuous values come into the view as an axis.

 Dimensions are usually discrete, and measures are usually continuous. However, this is
not always the case. Dates can be either discrete or continuous.

o Dates are dimensions and automatically come into the view as discrete (aka date
parts, such as "August", which considers the month of August without
considering other information like the year). A trend line applied to a timeline
with discrete dates will be broken into multiple trend lines, one per pane.

o We can chose to use continuous dates if preferred (aka date truncations, such as
"August 2024", which is different than "August 2025"). A trend line applied to a
timeline with continuous dates will have a single trend line for the entire date
axis.

Tip: For more information, see the training video Understanding Pill Types or Dimensions and
Measures, Blue and Green in the Help.

In Tableau Prep, no distinction is made for dimensions or measures. Understanding the concepts
behind discrete or continuous are important, however, for things like understanding the detail
versus summary presentation of data in the profile pane.

 Detail: the detail view shows every domain element as a discrete label and has a visual
scrollbar to provide a visual overview of all the data.
 Summary: the summary view shows the values as binned on a continuous axis as a
histogram.

Binning & Histograms

A field like age or salary is considered continuous. There is a relationship between the age 34
and 35, and 34 is as far from 35 as 35 is from 36. However, once we're past age 10 or so, we
usually stop saying things like we're "9 and a half" or "7 and ¾". We’re already binning our age
to neat year-sized increments. Someone who is 12,850 days old is older than someone who is
12,790 days old, but we draw a line and say they're both 35. Similarly, age groupings are often
used in place of actual ages. Child prices for movie tickets might be for kids 12 and under, or a
survey may ask you to select your age group, such as 20-24, 25-30, etc.

Histograms are used to visualize the distribution of numerical data using binning. A histogram is
similar to a bar chart, but rather than being discrete categories per bar, the rectangles making up
the histogram span a bin of a continuous axis, such as range of the number of blossoms (0-4, 5-9,
10-14, etc.). The height of the rectangles is determined by frequency or count of those values.
Here, the y-axis is the count of plants that fall into each bin. Seven plants have 0-4 blossoms, two
plants have 5-9 blossoms, and 43 plants have 20-24 blossoms.

In Tableau Prep, the summary view is a histogram of binned values. The detail view shows the
frequency for every value and has a visual scrollbar off to the side that shows the overall
distribution of the data.
Summary view Detail view
Distributions and outliers

Seeing the distribution of a data set can help with outlier detection.

 Distribution: the shape of the data in a histogram, though this depends on the size of the
bins. Being able to see all your data in a histogram view can help identify if the data
seems correct and complete. The shape of the distribution will only be of use if you know
the data and can interpret whether or not the distribution makes sense.

o For example, if we were to look at a data set of the number of homes with
broadband internet from 1940-2017, we'd expect to see a very skewed
distribution. However, if we were to look at the number of homes with broadband
internet from January 2017 to December 2017 we'd expect a fairly uniform
distribution.

o If we were to look at a data set of Google searches for "Pumpkin Spice Latte",
we'd expect to see a fairly sharp peak in the fall, whereas searches for “"convert
Celsius to Fahrenheit" would likely be fairly stable.

 Outlier: a value that is extreme compared to other values. Outliers may be correct values
or they may be indicative of an error.

o Some outliers are correct and indicate actual anomalies; these should not be
removed or modified.
o Some outliers indicate issues with data cleanliness, such as a salary of $50 instead
of $50,000 because a period was typed instead of the comma.
Visual outlier detection with distributions

Data Types

Databases, unlike spreadsheets, usually enforce strict rules on data types. Data types classify the
data in a given field and provide information about how the data should be formatted,
interpreted, and what operations can be done to that data. For example, numerical fields can have
mathematical operations applied to them and geographic fields can be mapped.

Tableau Desktop assigns whether a field is a dimension or measure, but fields have other
characteristics that depend on their data type. These are indicated by the icon each field has
(though some types share an icon). Tableau Prep uses the same data types. If data type is
enforced on a column and an existing value doesn't match its assigned data type, it may be
displayed as null (because "purple" doesn't mean anything as a number).

Some functions require specific data types. For example, you cannot use CONTAINS with a
numerical field. Type functions are used to change the data type of a field. For example,
DATEPARSE can take a text date in a specific format and make it a date, thus enabling things
like automatic drill down in the view.

ICON DATA TYPE


Text (string) values
Date values
Date & Time values
Numerical values
Boolean values (relational only)
Geographic values (used with maps)

Tip: For more information, refer to the Help article on Data Types.

Pivot and Unpivot Data

People-friendly data is often captured and recorded in a wide format, with many columns.
Machine-readable data, like Tableau prefers, is better in a tall format, with fewer columns and
more rows.

Note: Traditionally, pivoting data means going from tall to wide (rows to columns), and
unpivoting means going from wide to tall (columns to rows). However, Tableau uses the
word pivot to mean going from wide (people-friendly) to tall (machine-readable) by turning
columns into rows. In this document, pivot will be refer to the Tableau sense of the word. For
clarity, it can help to specify "pivot columns to rows" or "pivot rows to columns".

For more information, refer to the Help articles Pivot Your Data and Tips for Working with your
Data.
Wide data:In the WHO malaria data set, there is a column for country, then a column per
year. Each cell represents the number of cases of malaria for that country and year. In this
format we have 108 rows and 16 columns.

It's easy for a person to read and understand this format. However, if we were to bring this data
into Tableau Desktop, we get a field per column. We have a field for 2000, a field for 2001, a
field for 2002, etc.

To think of it another way, there are 15 fields that all represent the same basic thing—number of
reported cases of malaria—and no single field for time. This makes it very hard to do analysis
across time as the data is stored in separate fields.
Example: working with wide data

Another indication that this format isn't ideal for analysis can be seen in the fact that nowhere do
we have information about what the actual values mean. For Algeria in 2012, we have the value
55. Fifty five what? It's not clear from the structure of the data.
If the name of the column isn't describing what the values are but rather conveys additional
information, this is a sign the data needs to be pivoted.

Tall data

If we pivot the data, we reshape the data from wide to tall. Now, rather than having a column for
each year, we have a single column, Year, and a new column, Reported Cases. In this format we
have 1,606 rows and 3 columns. This data format is taller rather than wider.

Now in Tableau Desktop, we have a field for Year and a field for Reported Cases as well as the
original Country field. It's much easier to do analysis because each field represents a unique
quality about the data set—location, time, and value.
Note: this image has not been updated to reflect the most current UI. The Data pane no longer
shows Dimensions and Measures as labels.
Example: working with tall data

Now it's easy to see that for Algeria in 2012, the 55 refers to the number of reported cases
(because we could label this new column).

Normalization : Relational databases are made up of multiple tables that can be related or linked
together in some way. Each table contains a unique identifier, or key, per record. By relating or
joining on the keys, records can be linked to provide more information than is contained in a
single table. What information goes into each table is dependent on the data model used, but the
general principle is around reducing duplication.

For example, consider event planning for an event like a wedding. We need to keep track of
information at the level of groups (such as families or couples) as well as the level of individuals.

A table could be created that combines all the information together:


However, if an address is incorrect and needs to be fixed, it must be fixed across multiple rows,
potentially leading to errors or conflicts. A better structure is to create two tables, one for
information that pertains to the group (such as address and if the invitation was sent) and one for
information pertaining to the individuals (for things like seating assignments and dietary
restrictions).
Group table Individual table

It's much easier to track and analyze group-level information in the group table and individual-
level information in the individual table. For example, the number of chairs needed can be
obtained from the number of Attending = Yes records in the individual table, and the number of
stamps needed for thank-yous can be obtained from the number of records in the group table
where Gift isn't null.

The process of breaking up all the data into multiple tables—and figuring out which table
contains which columns—is called normalization. Normalization helps reduce redundant data
and simplifies the organization of the database.

So why didn't we just keep the original denormalized table? It is harder to maintain and was
storing redundant information. At scale, the level of data duplication can be come massive.
Storing the same information over and over isn't efficient.
Normalized tables have a few key properties:
 Each row needs a unique identifier
 Each table needs a column or columns that can be used to connect it back to other tables
(key).

These shared (key) columns are used for relating or joining tables back together. For our data,
the relationship or join clause would be on the Group field in each table.
Join Types

7. Advanced Visualization Tools: Using Filters, Using the Detail panel, using the Size
panels, customizing filters, Using and Customizing tooltips, Formatting your data with
colors.

After you create a dashboard, you might need to resize and reorganize it to work better for your
users.
Control overall dashboard size

Dashboard size options

Fixed size (default): The dashboard remains the same size, regardless of the
size of the window used to display it. If the dashboard is larger than the
window, it becomes scrollable. You can pick from a preset size or specify a
custom size.

Fixed size dashboards let you specify the exact location and position of the
content on the dashboard, which can be useful if there are floating objects.

Published dashboards that use a fixed size can load faster because they're
more likely to use a cached version on the server. For other performance tips,
see Optimize Workbook Performance.
Range: The dashboard scales between minimum and maximum sizes that
you specify. If the window used to display the dashboard is smaller than the
minimum size, scroll bars are displayed. If it's larger than the maximum size,
white space is displayed.

Use this setting when you're designing for two different display sizes that
need the same content and have similar shapes—such as small- and medium-
sized browser windows. Range also works well for mobile dashboards with
vertical layouts, where the width may change to account for different mobile
device widths, but the height is fixed to allow for vertical scrolling.
Automatic: The dashboard automatically resizes to fill the window used to
display it.

Use this setting if you want Tableau to take care of any resizing. For best
results, use a tiled (rather than floating) dashboard layout. Automatic sizing
can lead to unpredictable results on different screens, so use this setting with
caution if you don't know where the dashboard will be consumed.

Dashboards with variable sizes need to be freshly rendered for every browser
request which can have a performance impact.

Set overall dashboard size

 Under Size on the Dashboard pane, select the dashboard's dimensions (such as Desktop
Browser) or sizing behavior (such as Fixed size).

Group items using layout containers

Layout containers let you group related dashboard items together so you can quickly position
them. As you change the size and placement of items inside a container, other container items
automatically adjust. Layout containers can also be used for formatting.

Layout container types


A horizontal layout container resizes the width of the views and objects it contains; a vertical
layout container adjusts height.
Horizontal layout container Vertical layout container

The two views below are arranged in a horizontal layout container. The three views below are stacked in a
vertical layout contain

Add a layout container

1. Under Objects on the Dashboard pane, select Horizontal or Vertical.

2. Drag the container to the dashboard.

3. Add views and objects to the layout container.


Evenly distribute a layout container's items

1. Select the layout container. If you have trouble doing this, select an individual item
within the container and choose Select Container from its shortcut menu.

2. With the layout container selected, choose Distribute Evenly from its shortcut menu:
Items that are already within the layout container arrange themselves evenly; any items
you add will do the same.

Automatically resize sheets in layout containers

If you add multiple sheets with related data to a layout container, whenever marks are selected in
one sheet, you can automatically resize related sheets.

In this example, when a mark is selected in the map, the bar chart updates to display profit and
sales for that mark; when no marks are selected in the map, it automatically expands to fill the
layout container.

1. Add multiple sheets with related data to a layout container.

2. From the drop-down menu of the sheet you want to expand, choose Use as Filter.

3. Choose Dashboard > Actions, and double-click the generated filter you just created.

4. In the Target Sheets section of the Edit Filter Action dialog box, select the other sheets
in the layout container.

5. To control how target sheets resize when no marks are selected in the source sheet, select
one of the following:

o Show all values returns target sheets to their original size, showing all data.

o Exclude all values collapses target sheets under their titles, hiding all data.

Remove a layout container to independently edit items it contains

1. Select the container either on the dashboard or in the Item hierarchy area of the Layout
pane.
2. From the drop-down menu at the top of the container, select Remove Container.
Tile or float dashboard items

Tiled vs. floating layouts

Each object, layout container, and view that you place on a dashboard is either tiled (the default)
or floating.
Tiled layout Floating layout
Tiled items don't overlap; they become part of a Floating items can be layered over other objects. In
single-layer grid that resizes based on the overall the example below, a map floats over tiled views.
dashboard size.

For best results, give floating objects and views a


fixed size and position on a fixed size dashboard.

Float or tile a new item

1. Under Objects in the Dashboard pane, click the layout option you want to
use: Floating or Tiled.
2. Drag the view or object onto the dashboard on the right.

Tip: You can also assign a floating layout to an item by holding down Shift on your keyboard as
you drag it onto the dashboard.

Switch an existing item from tiled to floating

1. Select the item in the dashboard.

2. In the item's shortcut menu, select Floating:


Size, position, reorder, and rename individual dashboard items

Set an item's size and position

If you want a high degree of control over the placement of every item in a dashboard,
choose Fixed size or Range for overall dashboard sizing, and then set each item's size and
position using the Layout pane.

1. Select the dashboard item you want to position and size. In the Layout pane, the item's
name appears under Selected item.

Tip: To quickly toggle between the Dashboard and Layout panes, press the T key.

2. Define the item's position x and y position in pixels as an offset from the top left corner
of the dashboard. For example, to place an object in the top left corner of the dashboard,
specify x = 0 and y = 0.
The values you enter can be positive or negative but must be whole numbers.

3. To resize an item, click and drag it in the dashboard. You can also use the settings
under Size.

4. To hide the title of the item you have selected, clear the Show title check box. (The
similar Show dashboard title check box on the Dashboard pane controls the overall
dashboard title.)

Tip: To quickly position floating items, press arrow keys to move 1 pixel, or Shift+arrow keys to
move 10 pixels. To quickly resize items, add Alt (Windows) or Option (macOS) to these
shortcuts.

Align items with a grid

To present a visually consistent design, arrange and size dashboard items over a grid.

1. Choose Dashboard > Show Grid.

2. To change the grid size, choose Dashboard > Grid Options.

Tip: To quickly toggle the grid on and off, press the G key.

Reorder objects

The Item hierarchy area on the Layout pane lets you quickly change how objects are layered
and grouped on your dashboard. Items at the top of the list appear in the front, while items at the
bottom appear in back.
Reorder any object in Tableau Cloud or Tableau Server

In Tableau Cloud and Tableau Server, you can reorder both tiled and floating objects in the
hierarchy. You can also drag items both within their current containers, and into other containers
at any level. This lets you nest items with more flexibility than editing on the canvas, which
limits you to placing objects in the innermost container.
Reorder floating objects in Tableau Desktop

In Tableau Desktop, you can drag floating items at the top level of the hierarchy to change how
they layer over each other.

Rename items

To better distinguish between dashboard items, you can rename them.

In the Item hierarchy area of the Layout pane, right-click an item, and choose Rename
Dashboard Item. On the dashboard itself, this command is also available from the drop-down
menu for each object.
Add padding, borders, and background colors around items

Padding lets you precisely space items on dashboard, while borders and background colors let
you visually highlight them. Inner padding sets the spacing between item contents and the
perimeter of the border and background color; outer padding provides additional spacing beyond
the border and background color.

Note: If you can't change the border or background color for a particular dashboard item, change
its formatting at the worksheet level.

A. Outer padding B. Blue border C. Inner padding with light blue background

1. Select an individual item, or your entire dashboard.

2. On the Layout tab at left, specify border style and color, background color and opacity,
or padding size in pixels.
Here are some handy dashboard spacing tips:

 To precisely align one dashboard item with another, deselect All sides equal, and adjust
padding for only one side.

 To create seamless designs, specify zero outer padding for adjoining items.

Visually integrate elements with transparency

Transparent elements create a seamless visual look for your dashboards, revealing underlying
objects and images.
Tip: To create a background image that shows through floating transparent elements, add an
image object as the only tiled item. Fixed-size dashboards ensure that the floating elements
maintain a consistent visual relationship with the image, regardless of screen size.

Make worksheet backgrounds transparent

1. In your dashboard, select the sheet.

2. Choose Format > Shading, click the Worksheet menu, and choose None for the
background color.

If the sheet appears opaque, change the background color to None for the underlying
dashboard, object, or layout container. You can quickly adjust these items on the Layout
tab for the dashboard.

3. To smoothly integrate the transparent sheet with other dashboard items,


choose Format > Borders and Format > Lines, and either remove borders and lines or
change their colors.
Additional steps for transparent maps

1. Choose Format > Shading, click the Pane menu, and choose None for the color.

2. Choose Map > Map Layers, and deselect the opaque Base layer. Then, to make
transparent maps more distinct when zoomed out, select the Coastline layer.

Depending on the map style, you also may need to experiment with turning other layers
on or off.
Make a sheet partially transparent

1. In the Layout pane for the dashboard, select the sheet.

2. Click the Background color, and set the color and opacity.

Float transparent legends, filters, highlighters, and parameters

To visually connect filters, parameters, and highlighters to related data, float these items, which
are transparent by default. Text always remains fully opaque, maintaining legibility.

If a floating object continues to display a color, check these object- and worksheet-level settings:
 Select the object, and on the Layout tab, click the Background color, and choose None.
 Click the Format menu, and then choose Legends, Filters, Highlighters,
or Parameters. Then, in the Format pane at left, choose Shading > None.

8. Creating Dashboards & Storytelling, creating your first dashboard and Story, Design for
different displays, adding interactivity to your Dashboard, Distributing & Publishing your
Visualization.
Create a dashboard, and add or replace sheets
You create a dashboard in much the same way you create a new worksheet.
1. At the bottom of the workbook, click the New Dashboard icon:
2. From the Sheets list at left, drag views to your dashboard at right.

3. To replace a sheet, select it in the dashboard at right. In the Sheets list at left, hover over
the replacement sheet, and click the Swap Sheets button.

Note: When you replace a sheet, Tableau retains any padding, border, or background
color. However, you may need to adjust sheet size if content differs significantly. You
may also need to delete dashboard items specific to the previous sheet, such as filters,
which become blank.

Add interactivity

You can add interactivity to dashboards to enhance users' data insights. Try these techniques:

 In the upper corner of sheet, enable the Use as Filter option to use selected marks in the
sheet as filters for other sheets in the dashboard.
 When authoring in Tableau Desktop, add actions to use multiple sheets as filters,
navigate from one sheet to another, display web pages, and more. For details, see Actions
and Dashboards.

Add dashboard objects and set their options

In addition to sheets, you can add dashboard objects that add visual appeal and interactivity.
Here's guidance about each type:
 Horizontal and Vertical objects provide layout containers that let you group related
objects together and fine-tune how your dashboard resizes when users interact with them.
 Text objects can provide headers, explanations, and other information.
 Image objects add to the visual flavor of a dashboard, and you can link them to specific
target URLs. (While Web Page objects can also be used for images, they are better for
complete web pages. The Image object provides image-specific fitting, linking, and alt-
text options.)
 Web Page objects display target pages in the context of your dashboard. Be sure to
review these web security options, and be aware that some web pages don't allow
themselves to be embedded—Google is one example.
Note: For security reasons, your Tableau administrator may prevent Web Page and
Image objects from displaying target URLs.
 Blank objects help you adjust spacing between dashboard items.
 Navigation objects let your audience navigate from one dashboard to another, or to other
sheets or stories. You can display text or an image to indicate the button's destination to
your users, specify custom border and background colors, and provide informational
tooltips.
 Download objects let your audience quickly create a PDF file, PowerPoint slide, or PNG
image of an entire dashboard, or a crosstab of selected sheets. Formatting options are
similar to Navigation objects.
Note: Crosstab download is possible only after publishing to Tableau Cloud or Tableau
Server.
 Extension objects let you add unique features to dashboards or integrate them with
applications outside Tableau.
 Ask Data objects let users enter conversational queries for specific data source fields,
which authors optimize for specific audiences such as sales, marketing, and support staff.

Add an object

From the Objects section at left, and drag an item to the dashboard on the right:

Copy objects

You can copy and paste objects either within the current dashboard, or from dashboards in other
sheets and files. You can even copy objects between Tableau Desktop and Tableau in your web
browser.
You can't, however, copy the following:
 Sheets in a dashboard
 Items that rely on a specific sheet, such as filters, parameters, and legends
 Layout containers with something you can't copy inside them, like a sheet or filter
 Objects on a device layout
 Dashboard titles

Tip: In addition to the menu commands described below, you can also use the standard keyboard
shortcuts for copying and pasting on your operating system.

1. Select a dashboard object, and from the object menu, select Copy Dashboard Item. Or
from the main menu, select Dashboard > Copy Selected Dashboard Item.
2. Go to the dashboard where you want to paste the object. Then either select nothing to
paste in the upper-left corner of the dashboard, or select an existing item to paste next to.

3. In Tableau Desktop, choose File > Paste. In a browser, either choose Edit > Paste or use
the keyboard shortcut for pasting.

4. The object is pasted 10 pixels below and to the right of the upper-left corner of the
dashboard or the selected object. To move the pasted object, drag the handle at the top.

Note: Copied Show/Hide buttons may target the original object or be disabled. For instructions
on how to fix this, see Show and hide objects by clicking a button.

Set options for objects

Click the object to select it. Then click the arrow in the upper corner to open the shortcut menu.
(The menu options vary depending on the object.)
Detailed options for Image objects

With the Image object, you can either insert image files into dashboards or link to images posted
on the web. In either case, you can specify a URL the image opens when clicked, adding
interactivity to your dashboard.

Note: URLs for web-based images require the HTTPS prefix for improved security. For image
URLs with other prefixes, use the Web Page object.

1. From the Objects section at left, drag an Image object to your dashboard at right. Or, on
an existing Image object in a dashboard, click the pop-up menu in the upper corner, and
choose Edit Image.

2. Click either Insert Image File to embed an image file into the workbook or Link to
Image to link to a web-based image.

Consider linking to a web-based image when:

o The image is very large and your dashboard audience will view it in a browser.
(Unlike web-based images, inserted images must be downloaded every time a
sheet opens, slowing performance.)

o The image is an animated GIF file. (Inserted images don't support animated
GIFs.)
3. If you're inserting an image, click Choose to select the file. If you're linking to an image,
enter its web URL.

4. Set remaining image fitting, URL linking, and alt text options. (Alt text describes the
image in screen-reading applications for improved accessibility.)

Detailed options for Navigation and Download objects

Navigation and Download objects have several unique options that help you visually indicate a
navigation destination or file format.

A navigation button using text for the button style

1. In the upper corner of the object, click the object menu, and choose Edit Button.

2. Do one of the following:

o From the Navigate to menu, choose a sheet outside the current dashboard.
o From the Export to menu, choose a file format.

3. Choose image or text for Button Style, specify the image or text you want to appear, and
then set related formatting options.

4. For Tooltip text, add explanatory text that appears when viewers hover over the button.
This text is optional and typically best used with image buttons. (For example, you might
enter "Open Sales viz" to clarify the destination for a navigation button that appears as a
miniature sales chart.)
Publish Data Sources and Workbooks:

Suppose you create a view that exposes a new range of questions in the data you’re using, and
you want to share this analysis with other people using this data. Or maybe you are your team’s
Data Steward, in charge of building the data models approved for use by analysts, and meeting
your organization’s requirements for security, compliance, performance, and so on.

You can share your work with the rest of your team by publishing it to Tableau Server or
Tableau Cloud. After it’s published, you and your team can access it through your web browser
or the Tableau mobile app. Publishing data sources can also help you to centralize data
management.

Why publish
You can publish data sources and workbooks when you want to widen the audience for your data
analysis within your organization. By publishing you can begin to do the following:
 Collaborate and share with others
Allow people in your organization to view, interact with, download, subscribe to, share,
edit, and save published views, even if they do not use Tableau Desktop. Incorporate
views into blog posts or websites.
 Centralize data and database driver management
Create and publish data models that everyone can use. Centralized data management
allows for sharing a single source for your Tableau data. All workbooks connected to the
published data reflect updates to it.
In addition, when you publish and connect to data on the server, people connecting to the
data from Tableau Desktop do not need to install and maintain database drivers on their
own computers.
 Support mobility
Access your data from a different computer or location, through a web browser or the
Tableau Mobile iOS app. Sign in to your organization's Tableau Server from a private
network offsite.
What you can publish
Content types you can publish include:
 Data sources: You can publish data sources that others can use to build new workbooks.
A data source can contain a direct (or live) connection to your database or an extract you
can refresh on a schedule.
For information, see Best Practices for Published Data Sources.
 Workbooks: Workbooks contain your views, dashboards, and stories, and data
connection. You can include local resources, such as background images and custom
geocoding, if they reside in a location that the server or other Tableau users cannot
access.
Who can publish
To publish to Tableau Server or Tableau Cloud, your server or site administrator must grant you
the following capabilities:
 A site role of Creator (formerly Publisher) on the site you're publishing to.
 View and Save capabilities set to Allowed on the project into which you publish.
If you use Tableau Desktop and are not sure whether you can publish to a server, or you are
having trouble publishing, see your Tableau administrator. If you’re an administrator,
see Content Access and Ownership(Link opens in a new window) in the Tableau Server help (or
the Tableau Cloud version(Link opens in a new window)) for more information about site roles
and permissions
Publish a Data Source
Applies to: Tableau Desktop
When you are ready to make a data source available to other users, you can publish it to Tableau
Server or Tableau Cloud. If the data source is in a workbook that you published to Tableau
Server or Tableau Cloud, you can make it available by saving it, provided it’s an embedded
Excel or text file. For details, see Publish a Data Source on the Web.
Note: If you haven't yet read about best practices for creating data sources and when to create an
extract, see Best Practices for Published Data Sources.
General publishing steps
The following steps give an overview of the publishing workflow you will use regardless of the
type of data or the server you publish to. Below these steps you can find supplemental
information for authentication types and using Tableau Bridge.

1. Select Server > Publish Data Source.

If your workbook is connected to multiple data sources, select the one you want from the
Publish Data Sources submenu.

2. If you’re not already signed in to Tableau Server or Tableau Cloud, sign in now.

How you sign in depends on how your administrator has set up your environment. For
information, see Sign in to Tableau Server or Tableau Cloud.
3. In the Publish Data Source dialog box, do the following:

o For Project, select the project you want to publish to and enter the data source
name.

o For Description and Tags, add a description and tags that will help you and other
users find it.

Separate tags using either a comma or a space. To add a tag that contains a space,
put it in quotation marks (e.g., “Sales Quotes”).

o For Refresh Schedule, if publishing an extract, you have the option to select a
refresh schedule to ensure that your extract data stays fresh. If you choose not to
select a schedule here, you can select a schedule from Tableau Server after
publishing.

Note: This option is not available when publishing from the Data Source page or
to Tableau Cloud.

o For Permissions, accept the default project settings.

Generally a site administrator manages permissions on the server. If you think


your data source is an exception, work with your administrator to determine the
best course of action, and see Set Permissions as You Publish a Data Source or
Workbook.

o For Authentication, if you need to provide credentials to access your data, you
can specify how authentication should be handled when the data is published to
the server.

The options available for accessing the data source depend on the type of data you
publish and whether you are publishing to Tableau Server or Tableau Cloud.

Information appears at the bottom of the dialog box to let you know whether you
need to take further action, such as adding Tableau Cloud to your data provider's
authorized list.
For information about the authentication types, see Set Credentials for Accessing
Your Published Data.

4. If you are publishing file-based data that is on a Windows mapped drive, or using images
that will not be available from the server, select Include external files.

When you include external files, copies of the files are put on the server as part of your
data source. Copies of files are also put on the server and included as part of the data
source when you publish extracts of multi-connection data sources that contain a
connection to file-based data such as Excel. For more information about the implications
of publishing extracts of multi-connection data sources, see Join Your Data

If you do not want to publish the external files to the server, change the connection
information so that the data source references a full UNC path. For example, rather than
connecting to D:\datasource.xls, you would connect to \\filesrv\datasource.xls.

5. By default, during the publishing process, Tableau updates the workbook connection to
use the new published data source. It also closes the local data source.

To continue using the local data source instead, clear the Update workbook to use the
published data source check box.

Note: If you select Undo after publishing the data source, Tableau will revert to using the
local data source, but the data source will remain published. In addition, Tableau does not
replace a local data source when you publish a cube (multidimensional) data source to
Tableau Server. (Tableau Cloud does not support publishing cube data sources.)

6. Click Publish.

After publishing is complete, your web browser opens Ask Data for the data source,
where you can ask questions to automatically create vizzes. For more information,
see Automatically Build Views with Ask Data.

7. (Optional) Set up a refresh schedule on the server. For more information, see the
following topics:

o Schedule Refreshes on Tableau Server(Link opens in a new window)

o Schedule Refreshes on Tableau Cloud(Link opens in a new window)


o Schedule Refreshes Using Tableau Bridge - see the section below.

9. Tableau file types, publishing to Tableau Online, Sharing your visualizations, printing,
and Exporting.
Authorize Access to Cloud Data Published to Tableau Cloud
Applies to: Tableau Desktop

The information in this topic applies to you if you publish workbooks or data sources to Tableau
Cloud that contain live connections to cloud data—for example, Amazon, Google,
Salesforce.com.

As a security measure, cloud data providers might require you to supply a list of authorized IP
addresses from which external applications request access to your data. A request from an IP
address that is not explicitly approved could be rejected. To make sure live connections you
publish to Tableau Cloud remain uninterrupted, add Tableau Cloud to your data provider’s
allowlist (safe list).

The table lists IP address ranges Tableau Cloud uses, depending on your site location. You can
see its location in the URL that appears after you sign in to Tableau Cloud.
Host Name (Instance) Site Location IP Address or Range
10ax.online.tableau.com US West - Oregon 34.208.207.197

52.39.159.250
10ay.online.tableau.com US West - Oregon 34.218.129.202

52.40.235.24
10az.online.tableau.com US West - Oregon 34.218.83.207

52.37.252.60
us-west-2b.online.tableau.com US West - Oregon 34.214.85.34

34.214.85.244
us-east-1.online.tableau.com US East - Virginia 50.17.26.34

52.206.162.101
prod-useast-a.online.tableau.com US East - Virginia 3.219.176.16/28
prod-useast-b.online.tableau.com US East - Virginia 3.219.176.16/28
dub01.online.tableau.com EU West - Ireland 34.246.74.86
Host Name (Instance) Site Location IP Address or Range

52.215.158.213

eu-west-1a.online.tableau.com EU West - Ireland 34.246.62.141

34.246.62.203
prod-apnortheast-a.online.tableau.com Asia Pacific - Japan 18.176.203.96/28
prod-apsoutheast-a.online.tableau.com Asia Pacific - Australia 3.25.37.32/28
prod-uk-a.online.tableau.com EU West - UK 18.134.84.240/28
prod-ca-a.online.tableau.com Canada - Quebec 3.98.24.208/28

These addresses are dedicated to and controlled by Tableau.

Note: In addition to enabling communication over the Tableau Cloud IP range, you might need
to enable access over the appropriate database port (for example, 80 or 443) depending on the
communication type (HTTP or HTTPS).
Export Views from Tableau Desktop to Another Application
Applies to: Tableau Desktop

There are several ways to get views and workbooks out of Tableau Desktop and into a
presentation, report, or web page.

Note: If you're using Tableau Cloud or Tableau Server, instead see Download Views and
Workbooks and Link to a PNG, PDF, or CSV of a View.

Copy a view as an image

You can quickly copy an individual view as an image and paste it into another application, such
as Microsoft Word or Excel. If you're using Tableau Desktop on macOS, a TIFF (Tagged Image
File Format) image is copied to the clipboard. On Windows, a BMP (Bitmap) image is copied.

1. Select Worksheet > Copy > Image.

2. In the Copy Image dialog box, select the elements you want to include in the image. If
the view contains a legend, under Image Options, select the legend layout.

3. Click Copy.

4. Open the target application and paste the image from the clipboard.
Export a view as an image file

To create an image file that you can reuse, export the view rather than copy it. You can choose
BMP, JPEG, PNG, or SVG image file formats on macOS or Windows. Note, however, that SVG
substitutes Tableau fonts (Tableau Regular, Tableau Semibold, etc.) with a similar font.

1. Select Worksheet > Export> Image.

2. In the Export Image dialog box, select the elements you want to include in the image. If
the view contains a legend, under Image Options, select the legend layout.

3. Click Save.

4. In the Save Image dialog box, specify a file location, name, and format. Then click Save.
Export as a PowerPoint presentation

When you export a workbook to Microsoft PowerPoint format, selected sheets become static
PNG images on separate slides. If you export a story sheet, all story points export as separate
slides. Any filters currently applied in Tableau are reflected in the exported presentation.

Tip: To optimize a dashboard for PowerPoint, on the Dashboard tab, choose Size > Fixed
Size > PowerPoint (1600 x 900).

To export a workbook to PowerPoint:

1. Select File > Export as PowerPoint.

2. Select the sheets you want to include in the presentation. (Hidden sheets can also be
included.)

The exported PowerPoint file reflects the file name of your workbook, and the title slide
states the workbook name and the date the file was generated.

Tip: Choose File > Page Setup to show or hide titles, views, legends, and captions for an
individual sheet. (These options in the Show section aren't available for dashboards.)

Export to PDF

To create a vector-based file that embeds the Tableau fonts, print to PDF. After customizing the
layout of page elements using the File > Page Setup dialog, choose File > Print to PDF. For
detailed instructions, see Print Views from Tableau Desktop
Print Views from Tableau Desktop
Applies to: Tableau Desktop

Before printing, specify how you want the printed page to look using the Page Setup dialog box.
Then print to a printer or PDF.
Set up the page

You can apply different page setup options for each worksheet in a workbook, For example,
worksheets can print with titles showing or hidden, with unique page orientation, and more.

To begin, select File > Page Setup.

General settings (available for individual sheets, not dashboards)

 Show - Show or hide the title, view, caption, color legend, shape legend, size legend, and
map legend.

 Headers and Breaks - Control the appearance of these table elements.

o Repeat headers and legends on each page - adds table row and column headers at
the top of each printed page when a view breaks across several pages.

o Break pages on pane boundaries - prevents page breaks in the middle of a table
cell.

 Pages Shelf - If the view uses the Pages Shelf, specify whether to print the current page
or all pages.

Layout settings

 Legend Layout - If you include one or more legends, select how you want the legends to
appear on the printed page.

 Margins - Specify top, bottom, left, and right margins by typing values into the text
boxes.

 Centering - Optionally, select whether to center the view horizontally or vertically—or


both—on the page.

Print Scaling settings

These settings affect only printed documents, not exported images or PDFs. However, the page
orientation settings are used as the default when you publish the workbook to Tableau Cloud or
Tableau Server.

 Print Scaling - Scale a view to fit within a single page or print across multiple pages.
Select from the following options:

o Automatic – Scales the view automatically based on the paper size.

o Scale to – Scales the view to the specified percentage of its original size.
o Fit to – Scales the view to fit within the specified area. Select the number of
printed pages across and down. For example, if you have a really wide view that
is not very tall, you can specify three pages across by one page down.

 Page Orientation - Specify how you want the view oriented on the printed page. Select
from the following options:

o Use Printer Setting – Use the page orientation that is already specified by the
printer.

o Portrait – Presents the view so that it is oriented vertically on the printed page.

o Landscape – Presents the view so that it is oriented horizontally on the printed


page.

The following diagram shows the difference between portrait and landscape page
orientations.

Print a view

After you have configured the Page Setup settings, select File > Print. The following options in
the Print dialog box are unique to Tableau.

Show Selections

When this option is selected any selections you’ve made in the views will be maintained while
printing.

Change the Print Range

When you print from a workbook with multiple worksheets, each worksheet represents one or
more printed pages, depending on the page setup.
Select from the following print ranges:

 Entire Workbook - Prints all the worksheets in the workbook.

 Active Sheet - Prints only the sheet currently displayed in the workbook.

 Selected Sheets - Prints the selected sheets.

You can select multiple worksheets in a workbook by holding down the CTRL or Shift keys (or
the z key on a Mac) while clicking the worksheet tabs that you want to select.

Print to PDF

Note: If you're using Tableau Cloud or Tableau Server, instead see Download Views and
Workbooks and Link to a PNG, PDF, or CSV of a View.

In Tableau Desktop, you can save views as PDF files rather than printing them as hard copies.
You do not need to have Adobe Acrobat installed on your computer.

When you print an individual sheet to PDF, filters in the view are not included. To show filters,
create a dashboard containing the sheet and export the dashboard to PDF.

Print to PDF using a Windows computer

1. Specify page setup options for each sheet in your workbook.

2. Select File > Print to PDF.

3. In the Print to PDF dialog box, select the print Range:

o Entire Workbook - Publishes all the sheets in the workbook.

o Active Sheet - Publishes only the sheet currently displayed in the workbook.
o Selected Sheets - Publishes the selected sheets. To select multiple sheets in a
Tableau workbook, hold down the Ctrl key as you select sheet tabs along the
bottom of the Tableau workbook.

4. Select a Paper Size. If you select Unspecified, the paper size will expand to the
necessary size to fit the entire view on a single page.

5. Select View PDF File After Printing if you want to automatically open the PDF after
creating it. This option is only available if you have Adobe Acrobat Reader or Adobe
Acrobat installed on your computer.

6. Select whether to Show Selections. When this option is selected the selections in the
views are maintained in the PDF.

7. Click OK and specify where you want to save the PDF. Then click Sav
10. Creating custom charts, cyclical data and circular area charts, Dual Axis charts.
Tableau provides convenient options for building time series charts. The built-in date and time
functions allow you to use the drag-and-drop option to create and analyze time trends, drill down
with a click, and easily perform trend analysis comparisons.
To build a time series chart in Tableau, we will use the built-in Sample Superstore data that
comes with the Tableau installation. Please follow the steps outlined below to create a time series
chart.

1. Drag the Order Date field to the Columns shelf and the Sales variable to the Rows shelf.
The default chart will give us a yearly trend line chart. The Marks shelf automatically
selects a line graph for the chart.

2. In the chart above, we see that the display is in years. To further drill down to quarter and
month levels, we can simply click on the plus icon on the order date in
the Columns shelf. This will generate the following output, which now displays the data
broken down to the month and quarter level.
3. The above chart is useful, but it is displayed in a discrete format. It will be more
beneficial if the data is displayed in continuous form. To convert the chart into a
continuous format time series chart, the first step is to roll up the YEAR (Order
Date) back to year level, and then the second step is to right-click on it and select
the Year and Continuous options. This is illustrated in the chart below.
4. Another option in Tableau to build the continuous chart is to directly select the line chart
type in the Show Me card, as shown in the chart below.
The above chart shows the trend of annual sales during the period 2016 through 2019. There is a
continuous trend of increase in sales volume. However, it is better to analyze the time series data
by breaking it down to a monthly level.

5. It is easy to change the chart breakdown from annual to monthly. This can be done by
simply changing the Columns shelf from YEAR (Order Date) to MONTH (Order Date).
This will generate a monthly time series chart. From an analytics perspective, this chart is
more insightful as it allows us to see the sales fluctuations across months and years. This
is also useful for decomposing the seasonality and trend components of the time series
data.
6. Tableau also provides the ability to change the path property as well as the chart type.

Change the Path Property


We can change the path property by going into the Marks shelf and clicking on the Path option.
There are three options for the type of line graph for the view, and selecting the second option
will produce the following chart. The output is like the previous chart, but the trend shifts are
more pronounced now.

Change the Chart Type


We can change the chart type to options such as a bar or an area chart, either from
the Marks shelf or from the Show Me option. However, for time series data, this is not suggested
as the line chart is the best option.

Create an Area Chart

An area chart is a line chart where the area between the line and the axis are shaded with a color.
These charts are typically used to represent accumulated totals over time and are the
conventional way to display stacked lines. Follow the steps below to create an area chart.

The basic building blocks for an area chart are as follows:


Mark type: Area

Columns shelf: Dimension

Rows shelf: Measure

Color: Dimension

To create an area chart, follow the steps below:


1. Open Tableau Desktop and connect to the Sample - Superstore data source.

2. Navigate to a new worksheet.

3. From the Data pane, drag Order Date to the Columns shelf.

4. On the Columns shelf, right-click YEAR(Order Date) and select Month.

5. From the Data pane, drag Quantity to the Rows shelf.

6. From the Date pane, drag Ship Mode to Color on the Marks card.

7. On the Marks card, click the Mark Type drop-down and select Area.

The visualization updates to the following:


You can add formatting to an area chart. For example, you can edit the color legend and
turn on mark labels and borders. For more information, see Format at the Worksheet
Level(Link opens in a new window).

Create Dual Axis Charts :


A dual axis chart is used to present the relationship between two variables. More specifically,
these charts are useful for demonstrating the relationship between two or more measures with
different amplitude and scale. The dual axis charts help in presenting plenty of information in the
limited space present on your dashboard and also allows you to understand the trends, you may
have missed otherwise.
For example, in our US Super Store dataset, we have the Profit and Sales measures. These two
measures have different magnitude and scale. Let’s directly dive into the implementation in a
stepwise manner.
Here, for our visualization, we are going to use three attributes Sub-Category from the
dimensions and two measures i.e. Profit and Sales.
Open a new worksheet and add the Sub-category from the dimension pane to the Columns shelf.
Now pick Sales from the Measures pane and drop in the Row shelf below the Sub-Category.
Similarly, Select Profit measure and drop next to the Sales in Row shelf. After this step, your
visualization will look as shown in the image below.

Here we have two charts present on multiple axes. The next step is to convert these two different
charts into a dual axis chart. For this click on the triangle present on the profit pill in the rows
shelf.
Hereafter, you will have a drop-down menu just select the Dual axis option from that.

Once you select the Dual axis boom! your visualization changes completely. Like this
Although you have a dual axis visualization, they are on different scales. Now there is a need to
bring both measures on the same scale using synchronize axis. For this right-click on any axis
Profit or Sales and select synchronize axis from the menu. As shown in the following image.

Here is the result you have your Dual axis chart with synchronized axes.
To make it more interesting you can further play around with it. Like changing the shape of Sales
from Automatic to bar in the markets card or changing the respective colors, adding borders.

Similarly, you can go to Profit and change its shape to a line. Your final visualization will look
like this. Interesting right!

You might also like