Tableau function Level of detail

Tableau FIXED first invoice date to SQL

{ FIXED [Customer] : MIN([Date]) } returns each customer's earliest invoice date, the usual start of a cohort or acquisition analysis. It ignores the view, so a customer who buys from two teams shows the same first date under both. In SQL: min(min(Date)) OVER (PARTITION BY Customer) over the grouped rows.

Updated · Checked on the xmetric engine

What is the syntax?

{ FIXED [Customer] : MIN([Date]) }
dimensions
the fields the aggregate is grouped by, whatever the view shows.
aggregate
MIN([Date]) for the first date, MAX([Date]) for the latest.

Returns a date per row: the earliest date for that customer across the data source.

What does it return, and what is the SQL?

Each example runs on the same 12 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.

When did each customer first buy, shown per team?

Tableau

{ FIXED [Customer] : MIN([Date]) }

SQL (DuckDB)

SELECT
  Team,
  Customer,
  min(min(Date)) OVER (PARTITION BY Customer) AS result
FROM input
GROUP BY Team, Customer
ORDER BY Team, Customer

Aster's first invoice is with Pine on 20 December 2025, and its Cedar row shows that date too.

TeamCustomerResult
AshFern2026-01-20
AshGale2026-03-11
CedarAster2025-12-20
CedarBirch2026-01-12
ElmDahlia2026-01-08
OakHolly2026-01-15
PineAster2025-12-20
PineClover2026-02-14

The Tableau formula and the SQL return the same 8 rows.

What is each customer's first invoice date?

Tableau

{ FIXED [Customer] : MIN([Date]) }

SQL (DuckDB)

SELECT Customer, min(Date) AS result
FROM input
GROUP BY Customer
ORDER BY Customer

With only Customer in the view, a plain GROUP BY gives the same dates.

CustomerResult
Aster2025-12-20
Birch2026-01-12
Clover2026-02-14
Dahlia2026-01-08
Fern2026-01-20
Gale2026-03-11
Holly2026-01-15

The Tableau formula and the SQL return the same 7 rows.

Where does a straight translation go wrong?

Common mistake

Why does GROUP BY Team, Customer give Aster a later date under Cedar?

Grouping by the view finds Aster's first Cedar invoice, 5 January 2026. FIXED ignores Team and keeps the customer's overall first date, 20 December 2025.

Tableau

{ FIXED [Customer] : MIN([Date]) }

Tempting SQL

SELECT Team, Customer, min(Date) AS result
FROM input
GROUP BY Team, Customer
ORDER BY Team, Customer

SQL that matches

SELECT
  Team,
  Customer,
  min(min(Date)) OVER (PARTITION BY Customer) AS result
FROM input
GROUP BY Team, Customer
ORDER BY Team, Customer
TeamCustomerTableauTempting SQLSQL that matches
AshFern2026-01-202026-01-202026-01-20
AshGale2026-03-112026-03-112026-03-11
CedarAster2025-12-202026-01-052025-12-20
CedarBirch2026-01-122026-01-122026-01-12
ElmDahlia2026-01-082026-01-082026-01-08
OakHolly2026-01-152026-01-152026-01-15
PineAster2025-12-202025-12-202025-12-20
PineClover2026-02-142026-02-142026-02-14

The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.

How do I write it in Snowflake or BigQuery?

The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.

Snowflake

SELECT
  Team,
  Customer,
  MIN(MIN(Date)) OVER (PARTITION BY Customer) AS result
FROM input
GROUP BY Team, Customer
ORDER BY Team, Customer

Snowflake documentation

BigQuery

SELECT
  Team,
  Customer,
  MIN(MIN(Date)) OVER (PARTITION BY Customer) AS result
FROM input
GROUP BY Team, Customer
ORDER BY Team, Customer

BigQuery documentation

What does your own First invoice date formula return?

Edit the formula and run it on the 12 sample rows. Fields: [id], [Region], [Team], [Customer], [Invoice], [Revenue], [Date].

Runs in your browser on the xmetric engine. Nothing is uploaded.

Which functions go with it?

What do people ask about First invoice date?

Do filters change it?

Ordinary dimension filters on the Filters shelf do not: FIXED is computed before them. Add a filter to context (or filter the data source) to make it count only the rows that survive. In SQL, a context filter is a WHERE inside the subquery or window; an ordinary filter is a WHERE that does not reach it.

How do I build an acquisition cohort?

Use the first date as a dimension: DATETRUNC('month', { FIXED [Customer] : MIN([Date]) }) on Columns, then COUNTD([Customer]) or SUM([Revenue]).

How do I count days since the first invoice?

DATEDIFF('day', { FIXED [Customer] : MIN([Date]) }, [Date]) per line; in SQL, date_diff('day', min(Date) OVER (PARTITION BY Customer), Date).

Where is this documented?