{ FIXED [Region] : SUM([Revenue]) } adds revenue per region, whatever else the view shows: with Region and Team in the view, every team row carries its region's total. In SQL that is a window over the grouped rows, sum(sum(Revenue)) OVER (PARTITION BY Region), or a join to a per-region subquery.
Updated · Checked on the xmetric engine
What is the syntax?
{ FIXED [Region] : SUM([Revenue]) }
dimensions
the fields the aggregate is grouped by, whatever the view shows.
aggregate
an aggregate expression, such as SUM([Revenue]).
Returns a number per row: the total revenue of that row's region.
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.
What is each team's region total?
Tableau
{ FIXED [Region] : SUM([Revenue]) }
SQL (DuckDB)
SELECT Region,
Team,
sum(sum(Revenue)) OVER (PARTITIONBY Region) AS result
FROM input
GROUPBY Region, Team
ORDERBY Region, Team
Both North teams show 650 and both South teams 550, though the teams alone make North 650 (Cedar 500, Pine 150), South 550 (Ash 250, Elm 300), West 450.
Region
Team
Result
North
Cedar
650
North
Pine
650
South
Ash
550
South
Elm
550
West
Oak
450
✓ The Tableau formula and the SQL return the same 5 rows.
What does the FIXED value look like on each invoice line?
Tableau
{ FIXED [Region] : SUM([Revenue]) }
SQL (DuckDB)
SELECT id, sum(Revenue) OVER (PARTITIONBY Region) AS result
FROM input
ORDERBY id
A FIXED expression is a row-level value: every line carries its region's total, which is why it can be compared with [Revenue] on the same row.
id
Result
1
650
2
650
3
650
4
650
5
650
6
550
7
550
8
550
9
550
10
550
11
450
12
450
✓ The Tableau formula and the SQL return the same 12 rows.
Where does a straight translation go wrong?
Common mistake
Why does GROUP BY Region, Team give team totals?
FIXED ignores the view's dimensions. Grouping by the view sums each team, so Cedar shows 500 instead of North's 650.
Tableau
{ FIXED [Region] : SUM([Revenue]) }
Tempting SQL
SELECT Region, Team, sum(Revenue) AS result
FROM input
GROUPBY Region, Team
ORDERBY Region, Team
SQL that matches
SELECT Region,
Team,
sum(sum(Revenue)) OVER (PARTITIONBY Region) AS result
FROM input
GROUPBY Region, Team
ORDERBY Region, Team
Region
Team
Tableau
Tempting SQL
SQL that matches
North
Cedar
650
500
650
North
Pine
650
150
650
South
Ash
550
250
550
South
Elm
550
300
550
West
Oak
450
450
450
✓ The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.
Common mistake
Why does summing a row-level window multiply the total?
Tableau joins the region total to each mark once. Putting sum(Revenue) OVER (PARTITION BY Region) on every line and then summing per team adds it once per line: Cedar has three lines, so 3 x 650.
Tableau
SUM({ FIXED [Region] : SUM([Revenue]) })
Tempting SQL
SELECT Region, Team, sum(t) AS result
FROM (
SELECT Region,
Team,
sum(Revenue) OVER (PARTITIONBY Region) AS t
FROM input
)
GROUPBY Region, Team
ORDERBY Region, Team
SQL that matches
SELECT Region,
Team,
sum(sum(Revenue)) OVER (PARTITIONBY Region) AS result
FROM input
GROUPBY Region, Team
ORDERBY Region, Team
Region
Team
Tableau
Tempting SQL
SQL that matches
North
Cedar
650
1,950
650
North
Pine
650
1,300
650
South
Ash
550
1,650
550
South
Elm
550
1,100
550
West
Oak
450
900
450
✓ 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 Region,
Team,
SUM(SUM(Revenue)) OVER (PARTITIONBY Region) AS result
FROM input
GROUPBY Region, Team
ORDERBY Region, Team
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.
What aggregation does Tableau put around it?
SUM by default. Because the region total is coarser than the view, the value is repeated, and SUM, AVG, MIN and MAX of a repeated value all return it. Tableau's help says the same.
How is this different from EXCLUDE [Team]?
Same numbers here; see Region total excluding team. EXCLUDE responds to the view and to dimension filters, FIXED to neither.