Create Calculated Fields with Tableau Agent

Supported in Tableau Prep Web Authoring version 2024.2.

Note: Einstein Copilot has been renamed Tableau Agent, as the platform expands to accommodate more AI agent functionality. Starting in October 2024, you'll see updates to page sections, field names, and other UI text throughout Tableau Prep, Tableau Catalog, and Tableau Cloud Web Authoring. Help content and Trailhead modules are also being updated to reflect these changes.

Creating calculated fields is now easier than ever with Tableau Agent. Just describe a calculation, and Tableau Agent will create the formula, allowing you to add powerful calculated fields to your Prep flows with a single click. Previously, creating formulas for calculated fields required an understanding of objects and fields, available functions, and various limitations based on data types, formula types, and more.

Tableau Agent greatly simplifies the task of creating custom functions. Now both technical and non-technical users can easily create calculations using plain language. With the ability to quickly and efficiently create both row-level and summary formula fields from natural language descriptions, you can perform data preparation, making it easier and faster to combine, shape, and clean data for analysis.

Note: You must have Tableau+ and a connection to a Salesforce org with Einstein generative AI set up to use Tableau Agent in Tableau Prep. For more information, see Turn On AI in Tableau for Your Site(Link opens in a new window).

Create Calculated Fields

  1. Click on a clean step in the Flow pane.

  2. In the Profile pane toolbar, click Create Calculated Field, or in a profile card or data grid, click the More options menu and select Create Calculated Field > Custom Calculation.

    The Calculation editor with Tableau Agent tab showing.

  3. Provide a name for the field and in the Tableau Agent text box, describe the calculation that you want. Provide as much detail as possible to try to get better results.

  4. When your request is ready, click the arrow in the text box to pass it to Tableau Agent.

    Tableau Prep calculation editor showing Tableau Agent calculation response.

    Note: If Tableau Agent can’t provide a valid calculation, you can provide feedback.

  5. Evaluate the output to make sure that it’s what you want.

  6. Click Replace Calculation to add the calculation to the editor. You can then edit the calculation and customize if needed. You can also add additional prompts to refine the calculation and then replace the original calculation.

  7. Click Apply to create a field based on the calculation.

  8. Click Save to save the field and close the calculation editor.

Tips for getting the best results

  • Stick to basic instructions that result in calculation syntax.

  • Use a verb-noun structure.

    • Preferred: Write a calculation to extract the characters from the field…

    • Not preferred: For extracting characters, how can I change the way…

  • Use proper grammar and spelling.

Help Tableau Agent Improve

Tableau Agent is still learning how to build accurate Tableau Prep calculations. Some calculations created by Tableau Agent won’t be written the way you expected. When this happens, your feedback about what’s wrong with the calculation helps Tableau Agent continue to improve and build increasingly accurate calculations.

Examples

Example Calculation 1:

Prompt: Write a calculation to find the name of the month for orders in the Order Date field.

Tableau Prep calculation editor showing Tableau Agent returning a suggested calculation.

Example Calculation 2:

Prompt: Write a calculation to limit the values in the Quantity field by a maximum value of 10.

Tableau Prep calculation editor showing Tableau Agent returning a calculation.

In this example, an additional prompt is added to refine the calculations to keep values that are above the threshold.

Prompt: If the quantity is above the 10, replace it with the text "Above threshold" and keep the original values.

Tableau Prep calculation editor showing Tableau Agent suggesting an updated calc.

Thanks for your feedback!Your feedback has been successfully submitted. Thank you!