pbPassingBI
/
Cleaning & transforming intermediate 6 min

Splitting fields and calculations

Automatic and custom splits, and calculated fields inside a step.

What you'll be able to do
  • Split a field automatically and by delimiter
  • Write calculated fields
  • Use level-of-detail expressions in Prep

Automatic split

Field menu → Split Values → Automatic Split. Prep examines the values, works out the pattern, and creates new fields.

It handles the common cases well — Ana Silva into first and last, SKU-1234-RED into three parts. Check the result, since it guesses from the sample and an unusual value can break the pattern.

Custom split

Specify the separator and how many fields to create, splitting from the left or the right.

Splitting from the right is the answer for names where a middle name may or may not be present — the last token is reliably the surname, whereas splitting from the left puts the middle name in the wrong column.

Calculated fields

Add one from the toolbar inside any step. The syntax is Tableau's, so anything you know from Desktop works:

[Revenue] - [Cost]
IF [Revenue] > 1000 THEN 'High' ELSE 'Low' END
DATEDIFF('day', [Order Date], [Ship Date])
TRIM(LOWER([Email]))

That shared syntax is a real advantage over learning a separate expression language.

LOD and analytic calculations

Prep supports FIXED level-of-detail expressions and a set of analytic calculations:

{FIXED [Customer ID] : MIN([Order Date])}      -- first order per customer
{FIXED [Customer ID] : SUM([Revenue])}         -- lifetime value

There are also rank and row-number calculations for deduplication — keeping the most recent record per key, which is the same job as ROW_NUMBER() in SQL.

What Prep does not support is table calculations. Anything requiring the view context belongs in Desktop.

Where a calculation belongs

If a calculation is about shaping the data — cleaning, deriving a key, flagging rows — it belongs in Prep, computed once for everyone.

If it is about how the data is analysed — a ratio that depends on what is in the view — it belongs in Desktop.

Key points
  • Split from the right when a middle element is optional
  • Prep uses Tableau calculation syntax, including FIXED LOD expressions
  • Shaping calculations belong in Prep; view-dependent ones belong in Desktop
Check yourself