How to Create a Field in Tableau

Cody Schneider

Creating custom fields is one of the most powerful features in Tableau, allowing you to transform raw data into meaningful business insights. Instead of being limited to the data you start with, you can create new metrics, segment customers, or re-categorize information on the fly. This guide will walk you through the primary ways to create new fields in Tableau, covering calculated fields, groups, sets, and bins.

Why Bother Creating New Fields?

Your raw data rarely has every single metric you need for a report. You might have Sales and Profit, but what you really want to see is Profit Margin. You might have a list of states, but analyzing performance by Sales Region would be more useful. Creating custom fields lets you bridge these gaps without having to go back and change your original data source.

Here are a few common reasons to create new fields:

  • Perform calculations: Create new quantitative metrics like ratios, percentages, or conditional sums.

  • Transform data types: Convert text strings to dates, numbers to strings, or make other necessary adjustments.

  • Segment data: Group individual values into larger categories, like grouping hundreds of products into a few product lines.

  • Add conditional logic: Classify records based on certain criteria, such as labeling sales as "Large" or "Small" based on their value.

The Foundation: Creating a Calculated Field

Calculated fields are the workhorse of custom analysis in Tableau. They let you create a new field by defining a formula, much like in a spreadsheet. This formula can use other fields from your data, as well as a wide range of built-in functions.

Step-by-Step: Writing Your First Calculation

Let's create a classic and highly useful metric: Profit Margin. This is typically calculated as (Profit / Sales). We'll assume your data source already has Profit and Sales fields.

  1. Navigate to the Data pane on the left side of your worksheet. Right-click anywhere in the blank space of the pane and select Create Calculated Field…. Alternatively, you can go to the top menu and click Analysis > Create Calculated Field….

  2. The Calculation Editor window will pop up. This is where you'll define your new field.

  3. Name your field. In the top box, type a descriptive name like "Profit Margin".

  4. Write the formula. In the larger box below the name, you'll enter your calculation. As you start typing, Tableau will suggest field names and functions. For Profit Margin, the formula is:

    SUM([Profit]) / SUM([Sales])

    A quick note on aggregations: We use SUM() here because we typically want to calculate the profit margin across many aggregated records (e.g., the total profit margin for a whole region or category), not on a row-by-row basis. Using SUM() ensures the calculation is performed correctly after the data is aggregated in your view.

  5. At the bottom of the editor, a message will display "The calculation is valid." If there's an error, Tableau will provide a hint about what's wrong.

  6. Click OK.

You'll now see your new "Profit Margin" field in the Data pane, under the Measures section. You can drag it into your visualization just like any other field. To make it look right, right-click on the "Profit Margin" field, go to Default Properties > Number Format…, and select Percentage.

Example: A Calculation with Conditional Logic

Calculated fields aren't just for math. You can use them to categorize data. Let's create a field that labels customers based on their total sales volume.

In the Calculation Editor, create a new field named "Customer Segment". This time, we'll use an IF statement:

This formula checks the total sales for a given dimension in your view (like Customer Name). It assigns a category based on where that sales figure falls. Now you can drag "Customer Segment" onto your sheet to color-code your customers or see how many fall into each bucket.

Combining Members with Groups

Sometimes you need to combine several members of a dimension into a single category. For example, your "Country" data might have "USA," "United States," and "US." A group lets you combine these into a single "USA" entity for cleaner analysis.

Step-by-Step: Creating a Group

  1. In the Data pane, find the dimension you want to group. For example, let's use "Sub-Category".

  2. Right-click on "Sub-Category" and choose Create > Group….

  3. The Create Group window will appear, listing all the members of the dimension.

  4. Select the members you want to combine. For instance, hold Ctrl (or Cmd on a Mac) and click on "Chairs," "Tables," and "Furnishings."

  5. With them selected, click the Group button. Tableau will create a new grouped item and list the original members under it.

  6. You can rename this new group by clicking on the new name (e.g., "Chairs, Furnishings, Tables") and typing something clearer, like "Furniture".

  7. Repeat this for other items you want to group, like combining "Binders" and "Paper" into "Office Supplies."

  8. You can choose to check the Include 'Other' box, which will lump all ungrouped members into a single "Other" category. This can be very useful for simplifying busy charts.

  9. Click OK.

A new grouped field, named "Sub-Category (group)," will appear in your Data pane. You can now use this new field in place of the original to see your data aggregated by these custom groupings.

Creating Subsets of Data with Sets

Sets are a powerful way to create a custom subset of your data based on specific conditions. The result is a field that essentially separates your data into two categories: members that are IN the set and members that are OUT. This is perfect for things like finding your top 10 customers or isolating products that meet certain criteria.

Step-by-Step: Creating a Set

Let's create a set to identify our top 10 customers based on total sales.

  1. In the Data pane, find the dimension you want to analyze, such as "Customer Name".

  2. Right-click on "Customer Name" and choose Create > Set….

  3. The Create Set window will open. In the General tab, you could manually pick customers to be in your set, but that's not dynamic. Let's make it smarter.

  4. Click on the Top tab at the top of the window.

  5. Select By field. We want the Top 10 by Sales using the Sum aggregation.

  6. Configure the options to look like this: Top | 10 | by Sales | Sum.

  7. Give your set a name at the top, like "Top 10 Customers by Sales," and click OK.

You'll see the new set in the Sets section of your Data pane. Now you can use it in a view. A common practice is to drag "Customer Name" to Rows, "Sales" to Columns, and then drag your "Top 10 Customers by Sales" set to the Color shelf. This will instantly highlight your top 10 customers, separating them from everyone else (the "IN" group vs. the "OUT" group).

Grouping Measures into Bins

When you're dealing with a continuous numerical field (a measure), it's often useful to group the values into ranges, or "bins," to better understand their distribution. This is the foundation for creating histograms. For example, instead of looking at every individual order by its exact sales value, you could group orders into bins like $0-$100, $101-$200, etc.

Step-by-Step: Creating Bins

  1. In the Data pane, find a continuous measure you want to analyze, like "Sales".

  2. Right-click on "Sales" and select Create > Bins….

  3. The Create Bins dialog box will appear.

  4. Give the new field a name, or leave the default ("Sales (bin)").

  5. Tableau will suggest a "Size of bins" based on the range of your data. You can accept this suggestion or enter your own value. For example, if you enter 100, Tableau will create bins for $0-99, $100-199, and so on.

  6. Click OK.

A new dimension field with a histogram icon will appear in your Data pane. To see it in action, you can create a histogram:

  • Drag your new "Sales (bin)" field to the Columns shelf.

  • Drag COUNTD([Order ID]) (or your preferred count metric) to the Rows shelf.

This visualization will show you the number of orders that fall into each sales bracket, revealing the distribution of your order sizes.

Final Thoughts

Mastering the creation of calculated fields, groups, sets, and bins is foundational to moving from basic visualization to deep, customized analysis in Tableau. Each method serves a unique purpose, empowering you to shape your raw data into a format that answers your most specific business questions and tells a clearer story.

While building these fields in Tableau offers incredible control, sometimes you just need to get insights quickly without navigating multiple menus and writing formulas. That’s why we created a tool to make data analysis as simple as asking a question. With Graphed, you can connect platforms like Google Analytics or Salesforce and instantly build dashboards just by describing what you want to see, speeding up the entire process from data to decision.