Tableau function Level of detail
Tableau team share within region (EXCLUDE) to SQL
SUM([Revenue]) / SUM({ EXCLUDE [Team] : SUM([Revenue]) }) divides each team's revenue by its region's, so the teams of a region add up to 100%. In SQL: sum(Revenue) / sum(sum(Revenue)) OVER (PARTITION BY Region) over rows grouped by Region and Team.
Updated 2026-10-30 · Checked on the xmetric engine
What is the syntax? SUM ([Revenue] ) / SUM ({ EXCLUDE [Team] : SUM ([Revenue] ) })numeratorSUM([Revenue]) at the view's grain, one team.denominatorthe same sum with Team excluded, the region total. Returns a fraction per mark: the team's part of its region total.
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 share of its region does each team make? Tableau
SUM ([Revenue] ) / SUM ({ EXCLUDE [Team] : SUM ([Revenue] ) })SQL (DuckDB)
SELECT
Region,
Team,
sum (Revenue)
/ sum (sum (Revenue)) OVER (PARTITION BY Region) AS result
FROM input
GROUP BY Region, Team
ORDER BY Region, TeamCedar makes 500 of North's 650: 76.9%. Pine makes the other 23.1%. West has one team, so Oak is 100%.
Region Team Result North Cedar 0.77 North Pine 0.23 South Ash 0.45 South Elm 0.55 West Oak 1
✓ The Tableau formula and the SQL return the same 5 rows.
Where does a straight translation go wrong? Common mistake
Why do the shares add up to 100% across all regions instead? An empty window OVER () divides by the grand total of 1,650. EXCLUDE [Team] keeps Region in the grain, so the window must partition by Region.
Tableau
SUM ([Revenue] ) / SUM ({ EXCLUDE [Team] : SUM ([Revenue] ) })Tempting SQL
SELECT
Region,
Team,
sum (Revenue) / sum (sum (Revenue)) OVER () AS result
FROM input
GROUP BY Region, Team
ORDER BY Region, TeamSQL that matches
SELECT
Region,
Team,
sum (Revenue)
/ sum (sum (Revenue)) OVER (PARTITION BY Region) AS result
FROM input
GROUP BY Region, Team
ORDER BY Region, TeamRegion Team Tableau Tempting SQL SQL that matches North Cedar 0.77 0.3 0.77 North Pine 0.23 0.09 0.23 South Ash 0.45 0.15 0.45 South Elm 0.55 0.18 0.55 West Oak 1 0.27 1
✓ 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 (Revenue)
/ SUM (SUM (Revenue)) OVER (PARTITION BY Region) AS result
FROM input
GROUP BY Region, Team
ORDER BY Region, TeamSnowflake documentation
BigQuery
SELECT
Region,
Team,
SUM (Revenue)
/ SUM (SUM (Revenue)) OVER (PARTITION BY Region) AS result
FROM input
GROUP BY Region, Team
ORDER BY Region, TeamBigQuery documentation
What does your own Team share within region formula return? Edit the formula and run it on the 12 sample rows. Fields: [id], [Region], [Team], [Customer], [Invoice], [Revenue], [Date].
Formula Run it
Runs in your browser on the xmetric engine. Nothing is uploaded.
Which functions go with it?
What do people ask about Team share within region? Do filters change it? Yes. INCLUDE and EXCLUDE are computed after dimension filters, so filtering out a team removes its revenue from the region total too. That is the main practical difference from a FIXED region total.
Can I do this with a table calculation? Yes: Percent of Total computed along Team gives the same numbers. The LOD version keeps working when you sort, hide or move Team.
Why wrap the EXCLUDE in SUM? Tableau wraps a level of detail expression on a shelf in an aggregate. The region total is repeated on each team row, so SUM, MIN or MAX return the same value.
Where is this documented?