Tableau includes many built-in functions, but you will probably need to define custom calculations. In this video, learn how to create a calculated field.
- [Instructor] When you analyze your data in Tableau, it's possible that your original data source might not contain all of the values that you want. For example, you might know the quantity of items purchased and the price of those individual products, but you haven't calculated the total in the original data source. In this movie, I will show you how to perform those calculations based on the data that you do have by creating a calculated field. The sample file I'll work with is the 04_02_Calculated workbook, and you can find it in the Chapter 4 folder of your Exercise Files collection. I have a data table, where I have all of my products listed in alphabetical order, and then I don't have anything in the data field yet. And what I want to do is to multiply the measures of Quantity and Price to come up with the total spent for each of these products. Now the dataset I've provided already has Order Total as a field, so what I'm doing is recreating that, but the process that you'll go through, that's what you would use to create your own calculations. To create a calculated field, go to the Analysis menu, and then click Create Calculated Field. It's almost all the way to the bottom. In the Calculated Field dialog box, provide a name for the calculation, and rather than calling it Calculation 1, I will call it Total Spend, and then I'll click in the editing area below that. And here, I can start adding the arguments for the calculation. I want to multiply Quantity by Price. In Tableau, you indicate the name of a field by typing a left square bracket and then type the name of the field. So I have Quantity, and you see that I have it available as an auto-complete entry, so I'll press Tab. So I have Quantity, and I'll be multiplying, so I will use an asterisk, left square bracket again, Price. Great. And I see at the bottom left that the calculation is valid. If I make a mistake, for example, if I were to delete the right square bracket after Price, then I see that the calculation contains errors, and if I click the down arrow, I'll see that the column name is missing a right parenthesis. So I'll go ahead and come back up, add the square bracket back, and everything looks good. I'm done, so I'll click OK, and I have the Total Spend calculated field. Now all I need to do is drag it to the Data area and I get my values. If you want to rename a calculated field, go to the Analysis menu again, point to Edit Calculated Field, and click Total Spend. That's the calculation I created earlier. And you get the same dialog box back. So in this case, I'll call it Total Spent, and OK. So you can see the name has changed. If you realize you no longer need a calculated field, you can go over to the Measures area where it is, and then click the Field pill's down arrow, and just above halfway, there's a Delete option. Go ahead and click that. You've selected a field to delete. Are you sure you want to do that? Click Yes, and the field is deleted. In the best case, all of the information you want will be in your original data source, but if it's not, calculated fields let you figure out what you need to know.
- Managing data sources and visualizations
- Managing Tableau worksheets and workbooks
- Displaying source metadata
- Creating custom calculations and fields
- Analyzing data using statistical tools
- Sorting and filtering Tableau data
- Defining groups and sets
- Creating and pivoting crosstabs
- Formatting Tableau visualizations
- Creating basic charts
- Annotating and formatting charts
- Mapping geographic data
- Creating dashboards
- Methods for defining an URL-based action
Skill Level Beginner
1. Introduction to Tableau
2. Manage Data Sources and Visualizations
3. Manage Tableau Worksheets and Workbooks
4. Create Custom Calculations and Fields
5. Analyze Data
6. Sort and Filter Tableau Data
7. Define Groups and Sets
8. Develop and Pivot Crosstabs
9. Create Basic Visualizations
10. Format Tableau Visualizations
11. Annotate and Format Visualizations
12. Map Geographic Data
13. Build Dashboards and Actions
14. Tableau 2019.2 Updates
Define parameter actions4m 43s
Next steps1m 6s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.