Video | Tableau | Data prep | Data visualisation

The Find, Findnth & Len functions in Tableau

FIND, FINDNTH and LEN look simple on their own, but stack them together and you can pull apart almost any messy string.

Part ofTableau Functions
Watch on YouTube
  • FIND returns the position of a piece of text within a string, while FINDNTH lets you target a specific occurrence (e.g. the second hyphen)
  • Wrap aggregated string results with MIN, MAX or AVG, and use ATTR to avoid the 'can't mix aggregate and non-aggregate' error
  • You can replace the static number in RIGHT or LEFT with a calculation, so the position adapts to each record
  • LEN returns the length of any text, which you can subtract from a found position to count characters from the right
  • Hold Command (Ctrl on Windows) and scroll to zoom the calculation editor, and double-click a function to wrap it around highlighted text

FIND, FINDNTH and LEN each do something simple on their own, but combined they let you locate and extract any part of a text string, even when the position of what you're looking for changes from record to record.

Tim demonstrates using Superstore product names (to find commas) and order IDs (which contain two hyphens) as example strings with inconsistent formatting.

The Breakdown
  1. Find the position of a character with FIND 1:25

    FIND takes a string and the text you're looking for (in brackets/quotes) and returns the position where it first appears. Not every record will contain that character, so expect some results of zero.

  2. Fix the aggregation error before using the result 3:25

    Dragging a FIND-based field into the view aggregates it (usually as a sum), giving a meaningless total. Wrap it in MIN, MAX or AVG so it shows the true per-record value; MIN/MAX round to a whole number while AVG can introduce decimals.

  3. Feed that position into LEFT or RIGHT 4:42

    You can replace the static number normally used in LEFT or RIGHT with a calculation, such as your FIND result, so the cut-off point adapts to each record. This must come after you have a working position calculation, and mixing an aggregated position field with a non-aggregated string field triggers a 'can't mix aggregate and non-aggregate' error.

  4. Wrap with ATTR to resolve the aggregate mismatch 5:41

    Wrapping the string field in ATTR lets Tableau treat it consistently with the aggregated position value, clearing the error so the calculation validates.

  5. Adjust the cut point with simple maths 6:41

    Since FIND returns a number, you can add or subtract from it directly in the calculation, for example minus one to exclude the delimiter character itself from the extracted text.

  6. Target a specific occurrence with FINDNTH 7:19

    When a string contains the same character more than once (like two hyphens in an order ID), FINDNTH lets you specify which occurrence to find by adding a second argument for the instance number.

  7. Use LEN to measure from the right-hand side 9:30

    LEN returns the total length of any text. Subtracting a found position from LEN tells you how many characters from the right that position sits, which you can then feed into RIGHT to extract that portion.

  8. Stack the functions to solve real extraction problems 12:20

    Combining LEN, FINDNTH and RIGHT/LEFT (with ATTR to keep aggregation consistent) lets you pull out a variable-length substring even when its position isn't fixed. This is the kind of layered approach worth reaching for when a simpler split won't cope with inconsistent formatting.

Worth Knowing
  • Hold Command (Ctrl on Windows) and scroll in the calculation editor to zoom in and out.
  • Highlight the text you want wrapped, then double-click a function name, and Tableau wraps it around your selection automatically.
  • MIN and MAX tend to return cleaner whole numbers than AVG, which can introduce decimals due to how it calculates.
  • Regex can solve similar problems but is a separate topic not covered here.
Use It When

Reach for this stack when you need to clean up or extract part of a text field and the position of the delimiter or character you care about isn't consistent record to record.

How this Rollup was made provenance & method

A Rollup is drafted by AI from the video's transcript, then reviewed and edited by Tim. Everything used to produce this one is listed below — the model, the exact prompt, and the source video — so the process is transparent and reproducible.

Transcription
On-device — NVIDIA Parakeet v3 for recent videos, OpenAI Whisper large-v3 for earlier ones. The transcript never leaves the machine or gets published.
Drafting
Claude Sonnet 5 in the cloud, from that transcript.
Prompt
The exact Rollup prompt (v2) — the full system prompt, unedited.
Source video
Watch on YouTube
Drafted
5 July 2026 at 09:38
Reviewed & edited
5 July 2026 at 09:41 · by Tim Ngwena

Model + prompt + video is everything you'd need to recreate a Rollup like this yourself. The one thing we don't share is the transcript.

Rights. The video and its transcript are the property of TN Media Ltd. Unauthorised use or download is prohibited. © TN Media Ltd.