Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 113

Annotations

Annotations call attention to specific marks, points, or areas in a view. An annotation,


sometimes called a call-out, is most commonly displayed as a text box with a line pointing to a
specific point or mark. You can also add an area annotation, which calls out several marks or a
region of the view.

Three kinds of annotations: mark, point, and area. After you add an annotation, you can edit,
re-position, format, and remove it.

Adding Annotations

Annotations are an important part of publishing and sharing a view. Use annotations to call out
a specific mark, a specific point such as a value on the axis or a reference line, or an area such
as a cluster of scatter marks.
To add an annotation:
1. Right-click (Control-click on Mac) the view where you want to add an annotation and
select Annotate.

2. On the sub-menu select one of the following types of annotations:


o Mark - select this option to add an annotation that is associated with the
selected mark. This option is only available if a mark is selected.
o Point - select this option to annotate a specific point in the view.
o Area - select this option to annotate an area in the view such as a cluster of
outliers or a targeted region of the view.

3. In the Edit Annotation dialog box, type the text you want to show in the annotation.

Use the Insert menu to insert dynamic variables into the annotation text. For example,
the annotation can display data values that update as the underlying data changes. The
dynamic variables that are available are dependent on whether you are annotating a
mark, point, or area. Only relevant variables are available for each of these types of
annotations. For example, mark annotations can include dynamic data about that
specific data point such as dimension and measure values. Point annotations don't refer
to a specific data point but rather a place in the view. For that reason, point annotations
can only include dynamic information about that point, such as measure values along
the axes. Finally, when adding area annotations, only data relevant to the entire sheet is
available, such as title and sheet name.

Insert the All Values option using the Insert menu to show the data from the fields in the
view. As you add more detail to the view, this text is updated to show the live data.
4. When finished, click OK.
Mark Annotations

When you select a mark annotation the body and line are selected and several resize handles
display. Use these handles to resize the body and line.

To reposition the body


 Click and drag the body of the selected annotation to a new position.
To resize the body
 Click and drag the body resize handle left and right. The text and height are automatically
adjusted to fit the width of the body.

To resize the line


 Click and drag the line resize handle

Point Annotations

A point annotation marks a specific point in the view such as a reference line or a value on an
axis. Point annotations display as text with a line. When you select a point annotation, several
resize handles display. Use these handles to reposition and resize the body and line.
To reposition the body:
 Click and drag the body of the selected annotation to a new position. As you move the
body, the line is automatically resized so that it continues to point at the specific point
you selected.

To resize the body:


 Click and drag the side resize handles left and right. The text and height are
automatically adjusted to fit the width of the body.
To move the line end point:
 Click and drag the end point of the line so that it points at a new location.

Area Annotations

An area annotation is a way to highlight or call out an area in the view. Area annotations are
not associated with any particular mark, in fact, these annotations are commonly used to call
out several marks. When you select an area annotation, several resize handles and two text
handles display. Use these handles to reposition and resize the box and text.

To reposition the box

 Click and drag the box of the selected annotation to a new position.
To resize the box
 Click and drag one of the box resize handles

To reposition the text


 Click and drag the center text handle to a new position.
To resize the text width
 Click and drag the right text handle left and right. The text height is automatically
adjusted to fit the width.

Create Bins from a Continuous Measure:

Sometimes it's useful to convert a continuous measure (or a numeric dimension) into bins.
For example, suppose you create a view with Profit on Rows and State on Columns. You could
consider the State field as a set of bins—each profit value is sorted into a bin corresponding to
the state from which the value was recorded. But if you want to bin Profit values without
reference to a dimension, you can create a numeric bin, with each bin corresponding to a range
of values so that each profit value is sorted into a bin.
Note: You can bin data only for relational data sources. This feature is not supported for cube
(multidimensional) data sources.
When you bin a measure you create a new dimension. That's because you are creating a field
with a limited and discrete set of possible values out of a field with an unlimited, continuous
range of values. However, once the dimension is created you can convert it to a continuous
dimension. This can be useful if you want to create a histogram.
Create a Binned Dimension:
1. In the Data pane, right-click (control-click on Mac) a measure and select Create >Bins.

2. In the Create Bins dialog box, accept the proposed New field name or specify a
different name for the new field.

3. Either enter a value in the Size of bins field or have Tableau calculate a value for you.
If Tableau can perform the optimizing calculation quickly enough (in less than 1.5
seconds), the value you see initially in Size of bins is Tableau's estimate of the optimal
bin size.
If Tableau cannot perform the optimizing calculation quickly, the Size of bins field
defaults to 10. In this case you can click Suggest Bin Size to have Tableau perform the
optimizing calculation.
The formula that Tableau uses to calculate an optimal bin size is
Number of Bins = 3 + log2(n) * log(n)
In the formula, n is the number of distinct rows in the table. The size of each bin is
determined by dividing the difference between the smallest and the largest values by
the number of bins.
The four read-only fields in the lower part of the Create Bins dialog box show you the data that
Tableau uses to suggest a bin size. You can also consider these values if you want to set a bin
size manually. The values are:

Min The field's minimum value.

Max The field's maximum value.

Diff The difference between the field's minimum and maximum values.

CntD The number of distinct values (rows) in the data.

After you click OK to dismiss the Create Bins dialog box, a new binned field appears in the
Dimensions area of the Data pane.
When you add a binned dimension to the view, each bin acts as an equal-sized container that
summarizes data for a specific range of values. Column or row headers are created, where each
bin label designates the lower limit of the range of numbers that is assigned to the bin. Note
that the lower limit is inclusive.

Create a Histogram from a Binned Dimension


If you create a binned dimension, you can use it as the starting point for creating a histogram.
Using the Sales (bin) dimension created according to the instructions above, use the following
steps to create a histogram.
Note: A quicker way to create a histogram is using Show Me. See Build a Histogram in the Build-
It-Yourself Exercises section for information on creating a histogram using Show Me.
1. Click the Sales (bin) dimension in the Data pane and choose Convert to continuous.
2. Drag the Sales (bin) dimension from the Data pane and drop it on the Columns shelf.
3. Drag the original Sales field from the Measures area of the Data pane and drop it on
the Rows shelf.
4. Click SUM(Sales) on Rows and change the aggregation from Sum to Count.
The result is a histogram:
Blended Axis in Tableau:
The Blended Axis in Tableau is very useful to compare two measure values against the same
axis. In this session we will show you, How to Create Blended Axis in Tableau with example.

Blended Axis:
Drag and Drop the Year from Dimension Region to Column Shelf. Next, Drag and Drop the Sales
Amount from Measures to Rows Shelf. Since it is a Measure value, Sales Amount will be
aggregated to default Sum.

First Approach to create Blended Axis


In this example we want to compare Sales Amount against Total Product Cost so, Drag and Drop
one more measure value i.e., Total Product Cost from Measures to Rows Shelf. Since it is a
Measure value, Total Product Cost will be aggregated to default Sum.

To create blended axis in tableau Report, Please drag and drop the Total Product Cost from
Row Shelf to Sales Amount axis.

After the blended axis:


Second Approach to create Blended Axis:
You can directly drag the measure item from measures region to axis directly.

Following screenshot will show you the tableau blended axis report
Let us change the Year value to Month for detailed report.

Now you can see the blended axis report for each month
Let us change the value from Month names to all months present in each year.

Now you can see the detailed blended axis report for each month present in 2011, 2012, 2013,
and 2014
Add Analytics to Tableau Blended Axis Report
In order to add analytics, please navigate to Analytics tab, and double-click on the Forecast
option under the Model section.

Once you double click on the Forecast option, Forecast will be added to chart.
Hope you understood the creation of Tableau Blended Axis.

Bookmarks:

You can save a single worksheet as a Tableau bookmark. Bookmarks can be accessed from any
workbook using the Bookmarks menu. Bookmarks are convenient when you have worksheets
that you use frequently.
To save a Tableau bookmark:
1. Select Window > Bookmark > Create Bookmark.
2. Specify the bookmark file name and location in the Create Bookmark dialog box.
Tableau saves the file with a .tbm extension. The default location is the Bookmarks folder in the
Tableau Repository. However, you can save bookmarks to any location you choose. Bookmarks
that are not stored in the Tableau repository do not appear on the Bookmark menu.
You can organize bookmarks into folders in the same way you organize files or documents. This
can be useful when you have a large number of bookmarks to manage. For example, you might
organize bookmarks based on employee name, product types, or sales results. You can organize
bookmarks by creating a new folder, renaming an existing folder, renaming existing bookmark
files, and so on.
Delete bookmarks the same way you would delete any other file on your computer. After you
delete a bookmark from the Bookmarks folder in the Tableau Repository, it is removed from
the Bookmarks menu the next time you start Tableau.
While bookmarks are generally a snapshot of the worksheet and include the data connection,
formatting, etc., a bookmark does not include parameter values and the current page setting on
the Pages shelf.

Combined Tableau Sets:

The Combined Sets are very useful to compare two existing sets for further analysis. In this
article we will show you, How to Create Combined Tableau sets with example.

Combined Set in Tableau and their properties are:

 Name: Please specify the unique name for the set. Make sure, the name should reflect
the set functionality.
 Sets: Please select or change the existing Set from Drop down menu. First set will act as
Left Set and second will act as Right set
 All members in Both Sets: This option is similar to UNION ALL. If you select this option
then Combined Set will hold all the members from Left Set and Right Set.
 Shared Members in Both Sets: This option is similar to INTERSECT. If you select this
option then Combined Set will hold matching members from Left Set and Right Set. It
means, Every record should match the condition present in Left Set and Right Set
 Left Set except Shared Members: If you select this option then Combined Set will hold all
the members from Left Set except matching members from Right Set.
 Right Set except Shared Members: If you select this option then Combined Set will hold
all the members from Right Set except matching members from Left Set.

Creating Combined Tableau Sets


To create Combined Sets we need two sets so, we are going to use sets that we created in our
previous article. Please refer Tableau Set article to understand the creation of Sets.
In order to create Combined Tableau Sets, Please select two Sets from the Sets region and
right-click on it will open the context menu. Please select Create Combined Set option from the
context menu.

Once you select Create Combined Set option, a new window called Create Set will open to
configure the option.
All members in Both Sets
In this example we are going to find the Total number of States Present in Both Random 6 and
Top 10 States. In order to get all the records from both sets we have to select the All members
in Both Sets option

Click OK to finish Creating our first Combined tableau Sets. Next, Please Drag the newly created
set (States Present in Both Random 6 and Top 10 States) from Sets region to Row Shelf and
places it before the State filed as shown below.

From the above listing you can observe that, tableau report is displaying 12 records in IN
section. This is because, there are 16 records in both Random 6 States (6) and Top 10 States By
Profits (10) sets and within that 16, there are 4 common records so it is displaying 12 records.
Shared Members in Both Sets
In this example we are going to find the Total number of Common States Present in Random 6
States and Top 10 States by Profits sets. In order to get the Common records from both sets we
have to select the Shared Members in Both Sets option

Click OK to finish creating new Combined Set. Let us replace the States Present in Both
Random 6 and Top 10 States set with our newly created set, called Random States Present in
Top 10 List and see the result.
From the above listing you can observe that, California, Delaware, Georgia and Indiana are the
common fields in Random 6 States and Top 10 States by Profits sets.

Left Set except Shared Members

In this example we are going to find the Total number of States which are Not Present in Right
Set, Which is Top 10 States by Profits set. In order to get all the records from Random 6
States except the records from Top 10 States by Profits set, we have to select the Left Set
except Shared Members option
Click OK to finish creating new Combined Set. Let us replace the Random States Present in Top
10 List with Random 6 States not Present in Top 10 List and see the results.

From the above listing you can observe that, tableau report is displaying 2 records (District of
Columbia and Idaho) in IN section. This is because, there are 6 records in Random 6 States and
within that 6, there are 4 common records in Random 6 States and Top 10 States By
Profits sets so it is displaying 2 records.
Right Set except Shared Members

In this example we are going to find the Total number of States which are Not Present in Left
Set, Which is Random 6 States set. In order to get all the records from Top 10 States by
Profits set except the records from Random 6 States, we have to select the Right Set
except Shared Members option.

Click OK to finish creating new Combined Set. Let us replace the Random 6 States not Present
in Top 10 List set with our newly created set, called Top 10 States Not present in random 6
List and see the result.
Data Blending In Tableau

Data Blending in Tableau is very useful to join two data sources. For example, if you want to
generate tableau report using multiple data sources (or different data sources) then we can
simply use this Data Blending technique to join those data sources.

NOTE: In order to perform Data Blending in Tableau, We need at least one common field in
both data sources. It doesn’t matter, whether it is integer or string.

Steps involved for Data Blending in Tableau with example.


For this, we are going to use the data present in Excel Work sheet and SQL Server so, please
refer Connecting to Excel Files in Tableau and Connecting Tableau to SQL Server articles to
understand the connection settings.

Approach 1
First, we connected to Employees.xlsx workbook and added the Employee List sheet to data
region as shown below

In this example, our requirement is to create table report with employee first name, last name,
occupation, Sales and yearly income. So, we created simple table report with Occupation, Last
name, First name on Rows and Sales Amount and Yearly income on columns. Let us see the
report preview.

Scenario: Suddenly, Client changed the requirements and asked us to add department and
Salary Hike percentage details for every Employee. Here the real problem is, department and
Salary Hike percentage data is present in Master SQL Server database. It means, we have to
combine few columns from Local Excel Sheet and few from SQL Database
To do this, Please navigate to Data menu and select New Data Source option from Menu as
shown below or click on the Cylinder symbol

Once you select New Data Source option, following window will be appeared to Connect. Here,
we have to connect with SQL so select Microsoft SQL Server as shown below
From the below screenshot you can observe that, we selected the Department table from
server database.

Following screenshot will show the newly added data source (SQL) Department table
Let us add the Department name to the Rows Card. From the below screenshot you can
observe that, Tableau is displaying little orange tick mark at department name and also
displaying the warning message.
If you read the warning message, it is pretty straight forward message saying that, there is no
relation between Employees and department so, please add the relation.

In order to add relationship, Go to data menu and select Edit Relationships. Option as shown
below
Once you select Edit Relationships. Option, a new Relationships window will be opened.
Following are the option available in this window.
 Primary Data Source: Data Source from which we first dragged the fields (Dimension or
Measure) into report region is called as Primary data source. Tableau will display little
Blue tick mark beside this data source
 Secondary Data Source: Data Source which is not primary. Tableau will display little
orange tick mark beside secondary data source
 Automatic: If there are any common Filed names in both the data sources then tableau
will automatically detect the possible relationship between those two fields.
 Custom: If there are no common Filed names in the data sources, we have to select
Custom option and add the relationship between them. For now, we are selecting this
option
Dept. ID in Employee table and Id in Department table is the key columns we are going to use
for Data Blending on Employee and Department table as shown below.
Once you specified the relationship, tiny URL link will be appeared besides the Id column. From
the below screenshot, when you hover on that link, Use Id as linking filed tooltip is displaying.
Click the link button to enable Data blending in tableau

Once you click on the link button, link button color will be changed to Orange color and Our
Department column is displaying data. Remember, Null values will be displayed, if there is no
matching records in Department

Let us add Hike Rate measure to complete our client requirements.


Approach 2
Second approach is simple and straight forward. Instead of creating custom relationships
between Id and Dept ID columns, let’s give chance to the tableau intelligence

To do this, please select and right-click on the Id column will open the context menu. Please
select the Aliases.Option from the context menu as shown below

Once you selected the Aliases. Option, a new window will be popped up to rename the filed.
Let us change the Id Column to Dept. ID
Once you click OK button, Tableau will automatically detects the relationship between Dept. ID
in Employee table and Dept. ID in Department table. It means, you don’t have to create
relationship on your own. From the below screenshot you can observe that, tiny URL link will be
appeared besides the Dept. ID column. Click the link button to enable Data blending in tableau.

Once you click on the link button, link button color will be changed to Orange color as shown.
Let us add Department Name and Hike Rate to finish the business requirement.
Remove or Edit Relationships in Tableau
Please navigate to Data menu and select Edit Relationships. Option from Menu as shown.

Once you select Edit Relationships.Option, a new Relationships window will be opened. Please
select the Relationship you want to remove and Click Remove button. In this example we have
only one relationship between Dept. ID and Id so, we selected it and removed.
Since, we are using Department Name and Hike Rate in Tableau report, following warning
message is displayed.

Next, One more warning message which we seen before. Once you click OK button, Tiny URL
link will be remove besides the Id column as shown below
That’s it;we successfully removed the relationship required for data blending in tableau

Custom Geocode Your Data


Tableau recognizes country names, state/province names, city names, and area codes for many
countries world wide. However, there are some locations that Tableau does not recognize
immediately.
If you have location data that Tableau doesn't recognize, you can custom geocode your data so that
you can use it to create map views in Tableau with ease. Custom geocoding your data allows you to
create custom geographic roles that you can use as you create map views in Tableau.
For example, if your data contains country, state/province, and street address data, Tableau
Desktop will geocode your data to the country and state/province level, but will not recognize the
street address data. In this case, you can create a custom geographic role for the street address
data so that you can plot it on a map view in Tableau.
Follow the steps below to learn how to custom geocode your data.

Here's what you need to do:


1. Create one or more CSV files with your location data
2. Create a schema.ini file (optional)
3. Import the files into Tableau
4. Assign geographic roles to your fields
Before you start: Custom geocoding your data can be tricky. We recommend that you check out
the Format Geographic Fields in Tableau topic to learn more about geographic roles and the types
of data Tableau recognizes before you get started.

Step 1: Create a CSV file with your location data


The first step to custom geocoding your data is creating a CSV file to import into Tableau. The
contents of this file differ depending on whether you are extending an existing geographic
hierarchy, adding a new geographic role, or adding a new hierarchy to Tableau.
However, the following applies to all custom geocoding files:
 The .csv file must contain Latitude and Longitude columns.
 The latitude and longitude values you add must be real numbers. Make sure to include at
least one decimal place when specifying these values.

Extend an Existing Role


The built-in geographic roles in Tableau contain hierarchies that can be extended to include
locations relevant to your data. For example, the existing hierarchy of Country > State/Province may
not contain all of the states or provinces in your data. You can extend this level to include missing
states or provinces.
The import file for this type of geocoding should contain every level of the hierarchy above the level
you are extending. For example, if you are extending (adding data to) the State/Province geographic
role, the existing State/Province hierarchy has a column for Country and State/Province, along with
Latitude and Longitude.

In the import file, the names of the columns define the geographic roles. When extending an existing
role, the column names must match the existing geographic roles in the hierarchy that you are
extending. This will ensure that the new locations are added to the proper roles and hierarchies.
See the table below for information on how to organize hierarchies in your import file.

Built-In Hierarchy Columns to include in the .csv file (in order; left to
right)

Country (Name) Country (Name)


Latitude
Longitude
Country (Name), State/Province
Country (Name)
State/Province
Latitude
Longitude
Country (Name), State/Province, City
Country (Name)
State/Province
City
Latitude
Longitude
Country (Name), State/Province,
Country (Name)
County
State/Province
County
Latitude
Longitude
Country (Name), ZIP Code/Postcode
Country (Name)
ZIP Code/Postcode
Latitude
Longitude
Country (Name), Area Code
Country (Name)
Area Code
Latitude
Longitude
Country (Name), CBSA
Country (Name)
CBSA
Latitude
Longitude

In addition to the Country (Name) column, you can optionally include the following columns: Country
2 char (ISO 3166-1), Country 3 char (ISO 3166-1), and Country (FIPS 10). If you include these
columns, they should be just to the right of the Country (Name) column in any order.
Note: The highest level in the hierarchy is Country and cannot be extended to include higher levels
such as Continent, etc.

Add New Roles


To add new geographic roles to the existing geographic hierarchy in Tableau, format your import file
to include the new roles along with their parent roles.
When adding new roles to an existing hierarchy, the import file for those roles needs to contain the
columns for each level in the existing hierarchy. For more information on the columns to include in
each geographic hierarchy, see the built in hierarchy table in the Extend An Existing Role section.
Below is an example of an import file containing the locations of crater impacts in North America.
Importing the file below would add the geographic role Crater Name to the existing Country (Name),
State hierarchy. Notice that the column name for country matches the existing Country (Name)
geographic role.

Once you have created your import file, save the file as a Comma Delimited (.csv) file (Windows
Comma Separated if on a Mac) in a folder on your computer.

Add New Hierarchies


To add a new hierarchy in Tableau, you must create multiple import files, each representing a level
in the new hierarchy. For example, you may have custom sales that are defined by Theater,
Country, Region, and City. To create a new hierarchy from these geographic roles, you need to
create multiple import files, each representing a level in the new hierarchy.
For this example, the top level in the hierarchy is theater so the import file would include Theater,
Latitude, and Longitude.

The next level is Country, so its import file should contain columns for Theater, Country, Latitude and
Longitude.

Make sure that each file in the hierarchy contains columns for the current level and all levels above
it. For example, the City import file, the last geographic role in the hierarchy, would contain columns
for Theater, Country, Region and City.
Save each import file into a single folder and name each file with the level it represents. For this
example there are four import files named theater.csv, country.csv, region.csv, and city.csv.
(Back to top)

Step 2 (Optional): Create a schema.ini file


Sometimes when you attempt to import custom geographic information in Tableau using a .csv file,
you may see a ".csv could not be used because it does not contain a unique
column" error message.
This is because your .csv file might contain numerical data, such as numeric postcodes. Tableau will
only accept text fields for new geographic roles. However, you can create a schema.ini file to tell
Tableau that the numeric field you want to import should be treated as a text field.
To learn how to create a schema.ini file, see Create a schema.ini File .

Step 3: Import custom geocoding file(s) into Tableau Desktop


Once you have created a .csv file with custom geocoding you can import that file into Tableau.
1. Open Tableau Desktop and navigate to a new or existing worksheet.
2. Select Map > Geocoding > Import Custom Geocoding.
3. In the Import Custom Geocoding dialog box, click the button to the right of the text field to
browse to the folder your import file is saved in. All files in the folder will be imported into
Tableau.
4. Click Import.
The custom geocoding data is imported into the workbook and the new geographic roles become
available.

Where does Tableau store my custom geocoding data?


When you import custom geocoding, the data is stored in the Local Data folder in your Tableau
Repository. To import custom geocoding, your Tableau Repository must be on a local hard drive.
The custom geocoding is then available for all workbooks.
Save custom geocoding files in a separate folder on your local computer. If you have several
different sets of custom geocoding files, save each of them under their own folder names.
You can remove the custom geocoding stored in your Tableau Repository by
clicking Map > Geocoding > Remove Custom Geocoding. This will not remove the geocoding
from a packaged workbook, but it will remove it from the Local Data folder in your My Tableau
Repository.

What happens to my custom geocoding data when I save my workbook?


When you save your workbook as a packaged workbook, the custom geocoding data is packaged
with the workbook. When you open a packaged workbook you can import the custom geocoding
from that workbook into your own Tableau Repository.
Note: Importing a new custom geocoding file will replace any custom geographic roles previously
imported into Tableau.
(Back to top)
Step 4: Assign geographic roles to your fields
Once you import custom geocoding into your workbook, the custom geographic roles become
available. The next step is to assign those geographic roles to fields in your data source.
For example, if you decided to add a new geographic role that lists the latitude and longitude
coordinates of crater impacts in North America, you can assign that geographic role to a field in your
data source that lists the names of craters so when you create a map view with that field, the crater
impacts are plotted in the correct locations on the map view.
To assign a custom geographic role to a field, in the Data pane, click the data type icon next to the
field and select Geographic Role. Next, select a custom geographic role from the list.

You're now ready to start building a map view with your custom geographic roles. For more
information on how to build a map

Level of Detail expressions are also called LOD expressions in Tableau.


They are used to run complex queries involving many dimensions at
the data source level instead of bringing all the data to Tableau
interface. A simple example is adding dimension to an already
calculated aggregate value.

Types of LOD
There are three main types of LOD expressions.
 FIXED LOD This expressions compute values using the specified dimensions without reference to
any other dimensions in the view.
 INCLUDE LOD This level of detail expressions compute values using the specified dimensions in
addition to whatever dimensions are in the view.
 EXCLUDE LOD These levels of detail expressions subtract dimensions from the view level of
detail.

FIXED Level of Detail Expressions


Let's find the amount of Sales for each state in each region. Here we
first create the formula field named Regional Sales using the formula
below.

Next we drag the Region and State filed to the Rows shelf and the
calculated field to the Text shelf under the Marks card. We also drag
the Region field to the Color shelf. This produces the below view which
shows a fixed value for different states. That is because we have fixed
the dimension as region for the calculation of Sales value.
INCLUDE Level of Detail Expressions
INCLUDE level of detail expressions compute values using the specified
dimensions in addition to whatever dimensions are in the view. Let's
calculate the sum of sales per state for each sub-category of products.
For this we drag the Sub-Category field to the Rows shelf. The we write
the expression as shown below in the Columns shelf. It produces the
below view which includes both the dimensions in the calculations.
EXCLUDE Level of Detail Expressions
EXCLUDE level of detail expressions specify dimensions to exclude
from the view level of detail. Let's exclude Region from Sales figure
calculated for every month. We create the formula as shown below.
On dragging the relevant fields to the respective shelves we get the
final view for the EXCLUDE LOD.
Tableau Rank Calculation Advanced
21-12-2016 by sureshLeave a Comment

In our previous article, we had shown you the basic approach to calculate rank in tableau. In this
article we will show you, How to calculate Tableau Rank using the table calculation with
example. For this we are going to use the Employee table present the SQL Server. I suggest you
to refer Connecting Tableau to SQL Server article to understand the configurations. Following
screenshot will show you the data inside the Table, and as you can see it has 14 records:
Tableau Rank Calculation – Advanced
In this example, we will show you the advanced approach to calculate the tableau Rank. For this,
we are going to Drag and Drop the Occupation, Last Name, and First Name from Dimensions
Region to Rows Shelf. Next, drag the Yearly Income from Measures region to Text filed present
in the Marks Shelf.

In order to assign the Ranks in tableau we have to add the table calculation. To do so, please
click on the Down arrow besides the Yearly Income measure (change as per your requirement),
or right click on it will open the context menu. From the list of available options, please select
the Create option and then Calculated Field… option as shown below.
Once you click on the Calculated Field… option, a new window will be opened to write the
calculation.
RANK
In this example, we will calculate the rank so, we are using the RANK function. This function
accepts two arguments first, aggregated measure (or an expression) second, ranking order
(ascending, or descending). Here second argument is optional, and by default it is assigned as
DESC (descending).

Rank Function will assign the same rank to identical value. For example, if we have 100, 200,
200, 400 then the function will return the ranks as 1, 2, 2, 4 in ascending order
TIP: Click on the arrow that we rounded to show or hide the existing function. You can search
for the required function, and then check its syntax by selecting one.

Once you click on the OK button, tableau will assign the ranks for each record based on the
Yearly Income values
Edit Tableau Rank
To edit the existing table calculation, please click on the down arrow beside the table calculation
will open the context menu. Here you have to select the Edit Table Calculation option as shown
below.
Once you click on the Edit Table Calculation option, a new window called Table Calculation
will be opened as we shown below. As you can see, tableau has selected the Compute using
option as Table (down) by default.
Let us change the Compute using option from Table (down) to Specified Dimensions
(Occupation, Last name, and First Name). Note, we are selecting the Occupation dimension for
the Restarting every option. This will allow tableau to assign the ranking for each occupation. Or
we can simply say, Rank yearly income partitioned by Occupation.
Now you can see the result. It is calculating the Rank for each Partition (here, it is Occupation)
RANK_DENSE
In this example, we are using the RANK_DENSE function. This function accepts two arguments
first, aggregated measure (or an expression) second, ranking order (ascending, or descending).
Here, second argument is optional, and by default it will assign DESC (descending).

Rank_dense Function will assign the same rank to identical value but it will not skip the next
rank. For example, if we have 100, 200, 200, 400 then the function will return the ranks as 1, 2,
2, 3 in ascending order. In order to change the existing table calculation, please click on the
down arrow beside the table calculation and select the Edit.. option as shown below.
Let us change the function name from RANK to RANK_DENSE or write down your custom
function and click OK.
As you can see the result, It is calculating the Dense Rank for each Partition (here, it is
Occupation)
RANK_MODIFIED
In this example we are using the RANK_MODIFIED function. This function accepts two
arguments first, aggregated measure (or an expression) second, ranking order (ascending, or
descending). Here, second argument is optional, and by default it will assign DESC
(descending).

Rank_Modified Function will assign the same rank to identical value. The Highest value will be
ranked as 1, and the next two identical values will be ranked as 3. For example, if we have 100,
200, 200, 400 then the function will return the ranks as 1, 3, 3, 4 in ascending order
Now you can see the result. It is calculating the Modified Rank for each Occupation
RANK_PERCENTILE
In this example we are using the RANK_PERCENTILE function. This function accepts two
arguments one, aggregated measure (or an expression) second, ranking order (ascending, or
descending). Here, second argument is optional, and by default it is assigning the DESC
(descending).
Now you can see the result. It is calculating the Percentile Rank for each Occupation
RANK_UNIQUE
In this example we are using the RANK_MODIFIED function. This function accepts two
arguments first, an expression second, ranking order (ascending, or descending). Here, second
argument is optional, and by default it will assign DESC (descending).

Rank_UNIQUE Function will assign the unique rank to identical value. For example, if we have
100, 200, 200, 400 then the function will return the ranks as 1, 2, 3, 4 in ascending order
As you can see the result. It is assigning the Unique Rank for each items present in the
Occupation
Tableau Rank Calculation Basic
How to do the Tableau Rank Calculation with example. Following screenshot will show you the
data inside the Table.
Let me show you the list of available ranking options in tableau.

AVAILABLE RESULT
OPTIONS
Competition (1, 2, 2, 4) This option will assign the identical rank to Identical values and skips the next
rank. For example, if we have 100, 200, 300, 300, 400 then this option will
assign ranks as 1, 2, 3, 3, 5

Modified Competition Modified Competition option will assign the identical rank to duplicate values.
(1, 3, 3, 4) The Highest value will be ranked as 1, and the next two identical values will be
ranked as 3. The next value will be ranked as 4. For example, if we have 100,
200, 300, 300, 400 then this option will assign ranks as 1, 2, 4, 4, 5
Dense (1, 2, 2, 3) Dense option will assign the identical rank to Identical values but it will not
skips the next rank. For example, if we have 100, 200, 300, 300, 400 then this
option will assign ranks as 1, 2, 3, 3, 4

Unique (1, 2, 3, 4) This option will allocate unique values to each and every record. Though there
are identical values, it will assign unique ranking. Here, ranking factor will be
decided by the Order we specify.

Ascending and Descending Order Option: Under the Rank Calculation Type we have two
options:

1. Ascending: Rank will be assigned starting from lowest to highest. For example, if we have
100, 200, 300, 300, 400 then it will assign ranks as 1, 2, 3, 3, 5
2. Descending: Rank will be assigned starting from highest to lowest. For example, if we
have 100, 200, 300, 300, 400 then it will assign ranks as 4, 3, 2, 2, 1

Tableau Rank Calculation Basic


We will show you the basic approach to calculate the tableau Rank. For this, we are going
to Drag and Drop the Occupation, Last Name, First Name from Dimensions Region to Rows
Shelf, and Yearly Income from Measures region to Text filed present in the Marks Shelf.

In order to assign the Ranks in tableau we have to add the table calculation. To do so, please
click on the Down arrow besides the Yearly Income measure (change as per your requirement)
will open the context menu. From the list of available options, either you can select the Add
Table Calculation option or Quick Table Calculation option. For now, we are selecting
the Quick Table Calculation option, and then Rank option
Once you select the Rank option, tableau will assign the ranks for each record based on the
Yearly Income values

I think it will be nice to show the yearly Income values so that you can compare the Rank value
with the yearly Income. Let us add the Yearly Income to Columns Shelf. As you can see it will
create the Horizontal Bar chart. Please use the Show Me window to change the bar chart to
Text as we show below.
Following screenshot will show you the better view.

Edit or Alter the Tableau Rank Calculation


To edit the existing table calculation, please click on the down arrow beside the table
calculation will open the context menu. Here you have to select the Edit Table
Calculation option as shown below.

Once you click on the Edit Table Calculation option, a new window called Table Calculation will
be opened as we shown below. As you can see, tableau has selected the Rank Calculation Type
as Competition (1, 2, 2, 4), and Compute using option as Specified Dimensions (Occupation,
Last name, and First Name) by default. Here, you can uncheck the unwanted dimensions as
well.

Let us change the Rank calculation type from Competition to Modified Competition (1, 3, 3, 4),
and you can see the change in Rank
Let us change the Rank calculation type from Modified Competition (1, 3, 3, 4) to Dense (1, 2, 2,
3) and you can see the change in Rank

Lastly, we changed the Rank calculation type from Dense (1, 2, 2, 3) to Unique (1, 2, 3, 4) and
you can see the change in Rank
Tableau Rank Calculation for Cross Tab reports
In this example we will show you, How to calculate the rank in tableau for the cross tabled
reports (OR) calculate the rank for each partition. For this, we removed the First name from
Rows Shelf, and changed the Compute Using option to pane (down then across). Here we don’t
have any cross tabs so, it will calculate by going down.

First, we changed the Rank Calculation type to Competition (1, 2, 2, 4), and you can see the
result. It is calculating the Rank for each Partition (here, it is Occupation)
Let us change the Rank calculation type from Competition to Modified Competition (1, 3, 3, and
4). From the below screenshot you can see the Modified Competition Rank partitioned by
occupation.

Let us change the Rank calculation type from Modified Competition (1, 3, 3, 4) to Dense (1, 2, 2,
3). Form the below screenshot you can see the Dense Rank partitioned by occupation
Lastly, we changed the Rank calculation type from Dense (1, 2, 2, 3) to Unique (1, 2, 3, 4). You
can see the Unique Rank partitioned by occupation

Tableau Rank Calculation – Second Approach


Please click on the down arrow beside the measure value (Here it is Yearly Income) will open
the context menu. Here you have to select the Add Table Calculation option as shown below.

Once you click on the Add Table Calculation option, a new window called Table Calculation will
be opened.
Please change the calculation type from Difference From option to Rank

Next, change the Compute Using option from table (down) to Pane (across then down)
Tableau Running Total Calculation
21-12-2016 by sureshLeave a Comment

In this article we will show you, How to calculate the Tableau Running Total with example. For
this we are going to use the Data Source we created in our previous article so, Please visit Data
Labels in Tableau Reports article to understand the Data Source.

Calculating Tableau Running Total


Before we start calculating the running total, let me create a tableau report that we are going to
use in this example. First, Drag and Drop the order date (Year) from Dimension Region to
Column Shelf. Next, Drag and Drop the Order date (Quarter), and Order date (Month) from
Dimension Region to Rows Shelf. Lastly, Drag and Drop the Sales Amount from measures
region to text filed present in the Marks shelf. Once you drag them, following Table Report will
be generated.
As you can see we don’t have much data (sales) for the year 2010, and 2014. So, we are
excluding those two years from the table report by selecting those two columns, and then
clicking the exclude button present in the tool tip
Below screenshot will show you the final report that we are going to use for calculating the
running total.
In order to calculate the running total in tableau, we have to add the table calculation. To do
so, please click on the Down arrow besides the Sales Amount measure (change as per your
requirement) will open the context menu. From the list of available options, either you can select
the Add Table Calculation option or Quick Table Calculation option. I suggest you use the
Add Table Calculation option
Once you click on the Add Table Calculation option, a new window called Table Calculation
will be opened as we shown below. As you can see, by default, tableau has selected the
Calculation Type as Difference from, and Compute using option as Table (across).
Please change the calculation type from Difference From option to Running Total
Next, change the Computing using option from Table (across) to Table (down)
As you can see, we have successfully generated the tableau report that is calculating the running
total.
I think it will be nice to show the Sales Amount values. So that you can compare the Running
Total with the Original Sales Amount values. Let us add the Sales Amount to Columns Shelf. As
you can see it shows the Original values, and its running total for each individual year.
Tableau Running Total for each Partition
It will nice, if we calculate the Running total for each partition, or each Quarter. In order change
the existing calculation we have to edit it. To edit the existing table calculation, please click on
the down arrow beside the table calculation will open the context menu. Here you have to select
the Edit Table Calculation option as shown below.
Once you click on the Edit Table Calculation option, a new window called Table Calculation
will be opened. As you can see, tableau has selected the best possible options such
as: Calculation Type as Running Total, Aggregation as SUM, and Compute using option as
Specified Dimensions (Quarter of Order date, and Month of Order Date) by default. Here, you
have to change the Restarting Every option from None to Quarter of Order date. This wil
ensure tableau to restart the running total for every quarter of the year.

Now you can see the running total for each quarter
Add Secondary Calculation
Tableau allows us to add the secondary calculation to the report. It is very helpful to calculate
further on top of the existing calculation. To do so, Please check the Add Secondary
Calculation option as shown below.
Please leave all the default settings, and change the Secondary Calculation Type option from the
Difference From to Percentage Difference From
Following screenshot will show you the Percentage of difference in running total
Split a Field into Multiple Fields

If you have string fields in your data that contain multiple units of information, for example, the
first and last name of a customer, it might be easier to analyze the data if you split the values in
that field into separate fields. You can use split or custom split options in Tableau to separate
the values based on a separator or a repeated pattern of values present in each row of the
field. In this example, the common separator is a space character ( ).
The new fields created by the split or custom split are added to the data source as calculated
fields.
Splits and custom splits are based on the SPLIT string function. For more information, see String
Functions.
You can tell if your data supports the SPLIT function by checking the field drop-down menu:
 On the data source page, check the menu for Split and Custom Split.
 On the Data pane in the worksheet, check the menu for Transform > Split and Custom
Split.
Because different connection types support different functionality in Tableau, you may need to
check both places to determine if your data supports the split and custom split options.

Split fields automatically


A string field can be split automatically based on a common separator that Tableau detects in
the field.
Depending on the connection type, a split can automatically separate a field’s values in up to
ten new fields. The data type of the new fields generated by the split can vary depending on the
pattern combination that Tableau detects in the separator that is used to split the original field.
Note: In some cases, if the split takes too long to generate new fields or Tableau cannot find a
common separator, a custom split dialog box displays. For more information, see the Custom
split section.

To split a field automatically


1. On the Data Source page, in the grid, click the drop-down arrow next to the field name.
2. Select Split.
Note: You can also use the split option from the Data pane in the worksheet. In the Data pane,
right-click the field you want to split, and then select Transform > Split.
If you do not like the results of the split, you can go to the Data pane and edit the calculated
fields that are created by the split. Alternatively, you can click undo in the Tableau Desktop
toolbar or remove the split.

To remove fields created by a split


1. On the Data Source page, in the grid, click the drop-down arrow next to the field name.
2. Select Delete.
3. Repeat steps 1-2 to remove all the fields created by the split.

Alternatives to automatic split


Sometimes, using automatic split is not the best option. The following are example of cases
when you should not split fields automatically:
 Values contain different number of separators: Fields cannot be split automatically if
the number of separators varies from value to value. For example, suppose a field has
the following values:
jsmith| accounting | north
dnguyen | humanresources
lscott | recruiting| west
karnold |recruiting |west
In cases like this, consider using a custom split. For more information, see the Custom
split section.
 Values contain mixed separators: Fields cannot be split automatically if the separator
types are different. For example, suppose a field contains the following values:
smith.accounting
dnguyen-humanresources
lscott_recruiting
karnold_recruiting
In cases like this, consider using regular expressions to create new fields. For more
information, see Additional Functions.

Custom split
You can use the custom split option to specify a common separator for the split. Like the split
option, a custom split can separate a field’s values in up to ten new fields. In addition, you can
choose to split the values at the first n occurrences of the separator, the last n occurrences of
the separator, or at all occurrences of the separator. The data type of the new fields generated
by the custom split always results in a string data type.

To use a custom split


1. On the Data Source page, in the grid, click the drop-down arrow next to the field name.
2. Select Custom Split.

Note: You can also access the custom split option from the Data pane. In the Data pane, right-
click the field you want to split, and then select Transform > Custom Split.
If you do not like the results of the split, you can go to the Data pane and edit the calculated
fields that are created by the split. Alternatively, you can click undo in the toolbar or remove
the split.

To remove fields created by a custom split


1. On the Data Source page, in the grid, click the drop-down arrow next to the filed name.
2. Select Delete.
3. Repeat steps 1-2 to remove all the fields created by the custom split.

At a glance: Working with splits and custom splits


The following is a list of additional notes you might need to know about splits and custom splits.
 New fields generated from a split or custom split cannot be used as keys to join tables,
but can be used to blend data sources.
 New fields generated from a split or custom split cannot be used in a pivot.
 Split and custom split options are not supported for sets, groups, parameters, and bins.
 Microsoft SQL Server only allows up to four split fields.
 To generate more than ten new fields, consider using a split or custom split on the field
that was previously generated by a split or custom split.

Troubleshooting splits and custom splits


The following is a list of issues you might experience when using splits and custom splits:
 Split and custom split options missing for a supported data source type: Split and
custom split options are available only for fields that are a string data type.
 Null values or empty cells: After creating a split or a custom split, new fields might
contain null values or no values at all. Null values or empty cells occur when there are
no values for all of the expected new fields.
 Data has been removed: Tableau might use portions of the field’s values as a separator.
If a portion of a field’s values is used as a separator, those values no longer appear in the
new fields. For example, suppose a field contains the following values:
ZIP-98102
ZIP-98109
ZIP-98119
ZIP-98195

In this case, the split will create a new field with the following values:
98102
98109
98119
98195
The split will not create a separate field for “ZIP-“ because the split uses it as a separator

Create Custom Color Palettes

Tableau Desktop comes with color palettes that have been carefully designed to work well
together and effectively apply color to data in many situations, such as on maps, heat maps, bar
charts, etc. You can also create and use your own custom color palettes by modifying
the Preferences.tps file that comes with Tableau Desktop. For example, you can create a
custom categorical palette that matches your company's brand.
You can add as many custom palettes as you like, each with as many colors as you want. When
you modify Preferences.tps to add colors, use the standard HTML format for the new colors
(hexadecimal value #RRGGBB or Red Green Blue format). When you save the workbook, the
color information is embedded in Preferences.tps, but it won't be included as reusable color
encoding. This means that any colors that are in use are shown for anybody opening the
workbook; however, if they don't have the modified Preferences.tps file, they can't use the
color information for new color encoding.
Tableau doesn't test or support custom color palettes, so be sure to back up your workbooks
before you continue. Also, there is no guarantee that custom color palettes you create will
work with future Tableau Desktop upgrades.
Edit your preferences file
The Preferences.tps file is located in your My Tableau Repository. The file is a basic XML file
that you can open in a text editor to modify. An unedited preferences file looks like this:

To edit your preferences file:


1. Go to the My Tableau Repository folder in your Documents directory, and open
the Preferences.tps file.
2. Between the opening and closing workbook tags, insert opening and
closing preferences tags.
3. Follow one of the next three procedures to create a custom color palette.

Create a custom categorical color palette

A categorical color palette contains several distinct colors that can be assigned to discrete
dimension members. For example, when you put a discrete dimension such as Region on
the Color, the categorical color legend is used.

The following is an example of what to add between the preferences tags to add a categorical
color palette. Note that the type attribute is specified as regular, which identifies this palette as
a categorical palette.
To create a custom categorical color palette:
1. In the Preferences.tps file, between the "preferences" tags, paste the following:
<color-palette name="My Categorical Palette" type="regular" >
<color>#eb912b</color>
<color>#7099a5</color>
<color>#c71f34</color>
<color>#1d437d</color>
<color>#e8762b</color>
<color>#5b6591</color>
<color>#59879b</color>
</color-palette>
2. Save the Preferences.tps file and then restart Tableau Desktop.
3. Open the Superstore - Sample data source.
4. From the Dimensions pane, drag a discrete dimension, such as Region, to Color.
5. Click the color legend menu arrow and select Edit Colors.
6. In the Edit Colors dialog box, from the palette drop-down list, select your new
custom palette.

7. Click the Assign Palettebutton to assign the custom colors to each respective field.
8. Click OK.
Create a custom sequential color palette

Another type of palette is the sequential color palette. Typically, this type of palette shows a
single color, varying in intensity. This type of color palette is used for continuous fields, typically
for measures.
The following is an example of what to add between the preferences tags to add a sequential
color palette. Note that the type attribute is specified as ordered-sequential, which identifies
this palette as a sequential palette. Also, for sequential palettes you must specify each variant
of the color in the sequential color range.
To create a custom sequential color palette:
1. In the Preferences.tps file, between the preferences tags, paste the following:
<color-palette name="My Sequential Palette" type="ordered-sequential" >
<color>#eb912b</color>
<color>#eb9c42</color>
<color>#ebad67</color>
<color>#eabb86</color>
<color>#eacba8</color>
<color>#ebd8c2</color>
</color-palette>
2. Save the Preferences.tps file and then restart Tableau Desktop.
3. Open the Superstore- Sample data source.
4. From the Measures pane, drag the measure (e.g., Sales) to Color.
5. Click the color legend menu arrow, and select Edit Colors.
6. In the Edit Colors dialog box, from the palette drop-down list, select your custom
palette.
7. If you want each color gradation to be defined within a box, select the Stepped
Color check box, and in the Steps text box, type the number of color steps you want
to display in the bar.
8. Click the Advanced button.
9. Select the Start check box, and in the text box, type the low end number you want
for the continuum.
10. Click the Apply button to see the result, and make adjustments as needed. The
default for sequential color is to make the high end of the continuum pale and the
low end intense; select the Reversed check box to make the high end intense and the
low end, pale (this is the default when you keep the Automatic palette selection).

Create a custom diverging color palette

The third type of color palette is a diverging color palette. A diverging palette shows two ranges
of values using color intensity to show the magnitude of the number and the actual color to
show which range the number is from. Diverging palettes are most commonly used to show the
difference between positive and negative numbers.

The following is an example of what to add between the preferences tags to add a diverging
color palette. Note that the type attribute is specified as ordered-diverging, which identifies this
palette as a diverging palette.
To create a custom diverging color palette:
1. In the Preferences.tps file, between the preferences tags, paste the following:
<color-palette name="My Diverging Palette" type="ordered-diverging" >
<color>#eb912b</color>
<color>#59879b</color>
</color-palette>
2. Save the Preferences.tps file and then restart Tableau Desktop.
3. Open the Superstore - Sample data source.
4. Click the Assign Palette button. The colors in the palette are used in the order they
appear in the Preferences file.

If you add a sequential or diverging palette, remember to change the "type" attribute from
"regular" to one of the following:

 ordered-sequential

 ordered-diverging
(Optional): Assign a default custom palette to dimensions and measures and publish as a
data source

After you save the workbook, the custom color palette information is embedded in the
workbook (for Excel and text file-based workbooks, in the .twbx) and therefore only available
for that workbook. This means that colors that are in use are shown for anybody opening the
that particular workbook. If they don't have the modified preferences file, they can't use the
color information for any new color encoding.
To allow new color encoding using the custom color palette or to standardize a custom color
palette for the Tableau workbooks in your organization, you can create the custom color
palette using one of the options above, and then publish it as a Tableau Server data source.
1. On the same computer from which you modified the Preferences.tps file, open
Tableau Desktop.
2. Open the Superstore - Sample data source.
3. Right-click a field in the Data pane, and select Default Properties > Color.
4. In the Edit Colors dialog box, associate the field values with the custom color palette,
and then click OK when finished.
5. From the Data menu, select the data source, select Publish to Server, and then
complete process to publish the data source.
After publishing the data source to Tableau Server, connect any new workbooks to this data
source to use the custom color palette.

Totals in Tableau:
Add Totals in Tableau is the easiest thing in Tableau.It’s just a matter of check marks. In this
session we will show you, How to add totals in Tableau and this includes adding Row Totals,
Column Totals, Grand Totals and Subtotals with example.

Steps to add Totals in Tableau

We are going to add totals to below shown report. If you observe the below screenshot, it was
just a normal table report.
To add Totals in Tableau, go to Analysis Menu and select Totals and check mark the required
option. For instance, to display Rows total we have to select Show Row Grand Totals Option.

Once you select Show Row Grand Totals Option, an extra Grand Total column will be added
with all the row totals as shown below
In order to display the Column totals, go to Analysis Menu and select Totals and check mark
the Show Column Grand Totals Option as shown below

Once you select Show Column Grand Totals Option, an extra Grand Total row will be added
with all the column totals. If you observe the below screenshot, we rounded 29,358,677
because it is the Super Grand Total of all products.
Now, let us see how to add subtotals in tableau or simply, totals of nested regions. To explain
this, we removed Country names from column card and added it to rows card

Add Subtotals in Tableau

To add Subtotals in Tableau, go to Analysis Menu and select Totals and check mark the Add All
Subtotals Option.
Once you select Add All Subtotals Option, an extra Total row will be added in the nested region
to display the column totals.

Remove Totals and Subtotals in Tableau

To remove Row Grand Totals and Column Grand Total, go to Analysis Menu and select Totals
and uncheck the corresponding option. To remove Subtotals in Tableau, we have to
select Remove All Subtotals Option as shown below

You might also like