0:07

Hello. In this lesson,

we will focus on calculated fields and creating new variables from existing variables.

After this lesson, you will be able to explain some of

the functions calculated fields allow you to perform.

You will be able to create new vocabulary fields and describe

the fields parameters and functions listed in Tableau. Let's begin.

Calculated fields allow you to compare fields,

apply aggregations, apply logic,

convert dates or perform a myriad of

other analytical and mathematical functions on

your data without needing to make changes to your database at all.

Calculated fields return a reusable,

drag-and-drop field into your data window and the cache table.

You can even calculate on top of your calculations.

Calculated fields allow you to compare fields,

apply aggregations, apply logic,

convert dates or perform a myriad of

other analytical and mathematical functions on

your data without needing to make changes to your database at all.

Calculated fields return a reusable,

drag-and-drop field into your data window and the cache table.

You can even calculate on top of your calculations.

Let me show you how to create a new calculated field.

Let's start by opening our superstore data set and

then let's right-click anywhere in the data pane or side bar.

This will bring up additional options.

Then you will click on "Create Calculated Field".

The name at the top of the box will be the name of your new field in the data window.

Make the name descriptive enough to aid you in

identifying it when it's not so fresh in your mind.

The text box beneath the name is where you'll build your calculation.

Here to the right is a list of functions available to use in Tableau.

When you select a function,

the area to the right of the function gives you

more information on how to use that function and examples.

There are far too many for us to detail now,

but take some time to explore each of the functions in the Tableau functions list.

Bear in mind that the drop-down menu will

filter the different types of functions based on type.

2:26

I want to illustrate how the formula area works.

To do so, let's focus on a simple calculation.

I will show you how to create a simple subtraction formula by selecting one measure,

entering a subtraction sign,

and then selecting another measure.

Let's begin by giving our new calculation a name.

We will call this, net profit.

Next, I will drag our profit to the calculation window,

then enter a subtraction sign,

and then drag our sales field to the calculation window.

If we know what field we want to use,

there is another way to do this Instead of dragging the fields to the calculation window.

We can just begin typing and then click on the field.

Tableau will automatically check to see if your calculation is valid.

You can see that Tableau tells you that the calculation is valid.

Let's purposely enter a broken formula to see what happens.

We'll take the above formula and divide it by text field, such as state.

Tableau now tells us that the calculation

contains errors and that we have a problem with our formula.

Tableau goes another step and offers a drop-down area

at the end of the error message to help us troubleshoot our mistake.

Tableau picked up right away on our text field error.

If you click on the error message,

Tableau will take your cursor to the problem area of your formula for you to fix.

When we corrected the error,

we'll click "Okay" and complete our calculation.

So, let's delete the state variable and the division sign and click on okay.

The new calculation will appear in the data window with

this special icon to indicate that it is a calculation.

Now, we can use this field in any calculation.

Next, let's see how to create a calculated field from an existing variable.

To start, let's right-click on any variable

we want to use in our new field. Let's say, profit.

Now, let's click on "Create" and then choose calculated field.

Now, we have our normal calculation window,

but we have already pulled our profit field we want to use.

From that point, you can continue creating your new calculation.

With all of the different formulas available in the calculated field window,

it's clear that Tableau provides an incredible amount of

power available for building custom formulas,

calculations, and advanced fields.

I hope this lesson helps you establish skills and the basic functions.

After that, the best way to develop mastery in Tableau is through test and explore,

which I encourage you to do.

Okay. After this lesson,

you should now understand what calculated fields

are used for and how to create new fields.

In the next lesson, we will cover

a quick table calculations that allow you to explore and explain your data even further.

Okay. After this lesson,

you should now understand what calculated fields

are used for and how to create new fields.

In the next lesson, we will cover

a quick table calculations that allow you to explore and explain your data even further.