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.

Â