Aggregations in Calculations - Tableau
- Which calculation returns the average revenue per order at the current level of detail? Answer:
SUM([Sales]) / COUNTD([Order ID]), returning When a question asks for a metric "per order," you need to identify the right denominator — and that means distinguishing between counting distinct entities versus counting raw rows. There are 5 total line items across 3 distinct orders (O1, O2, O3), with total sales of . Average revenue per order means dividing that total by the number of unique orders: . That's exactly what A does —SUM([Sales]) / COUNTD([Order ID])usesCOUNTD(count distinct) to count 3 unique orders, giving . This is the correct answer. B is wrong becauseAVG([Sales])averages at the row level, dividing total sales by the number of line items (). That gives you average revenue per line, not per order — a fundamentally different granularity. C makes the same granularity mistake as B, but more explicitly.COUNT([Order ID])counts every row (5 rows), not distinct orders, so again. The trap here is thatCOUNTandCOUNTDlook similar but behave very differently when rows repeat an ID. D divides byCOUNTD([Customer ID]), which counts 2 customers, yielding . That's average revenue per customer, not per order — a different aggregation level entirely. The key study tip: whenever you see "per [entity]," always ask whether you needCOUNT(rows) orCOUNTD(unique values). On Tableau exams, confusing these two is one of the most common traps. - What value does
COUNT([Return ID]) / COUNTD([Order ID])return, assuming standard numeric division?Answer: , because three non-null returns are divided by two distinct orders When working with aggregate functions in Tableau, you need to carefully track which records each function counts — andCOUNTvs.COUNTDbehave very differently around nulls and duplicates.COUNT([Return ID])counts non-null values in the Return ID field. Looking at the four records, the Return IDs are R1, null, R2, and R3 — so three non-null values, givingCOUNT = 3.COUNTD([Order ID])counts distinct non-null values. The Order IDs are O1, O1, O2, and null — two distinct non-null values (O1 and O2), givingCOUNTD = 2. The expression therefore evaluates to , confirming B is correct. Choice A is wrong because it confusesCOUNT([Return ID])with a total row count. Counting all four records ignores howCOUNTskips nulls — it never reaches 3 returns "out of four records" in the way A describes. Choice C incorrectly assumes both functions somehow filter to only "matched" rows; there's no join logic here, just independent aggregations over all four records. Choice D misreadsCOUNT([Return ID])as a row count (4), which would only be true if you usedCOUNT(*)or counted a field with no nulls. A reliable study tip: whenever you seeCOUNTandCOUNTDtogether, pause and explicitly list out what each one sees.COUNTdrops nulls;COUNTDdrops nulls and duplicates. Writing out the values as a quick table — just like above — prevents you from conflating row counts with field-level aggregations. - Which calculation produces the required overall profit margin? Answer:
SUM([Profit]) / SUM([Sales]), returning When calculating a ratio across multiple rows in Tableau, you need to think carefully about the order of operations — specifically, whether aggregation happens before or after division. The correct way to compute overall profit margin is to sum all profits, then divide by total sales: . This is exactly what C does —SUM([Profit]) / SUM([Sales])aggregates both measures first, then performs the division, giving you a true blended margin. A is the most tempting trap.AVG([Profit] / [Sales])computes each row's margin individually — and — then averages them: . This treats both transactions as equally weighted, ignoring that the second transaction has nine times the sales volume. It answers "what is the average of the two margins?" not "what is the combined margin?" B makes the same row-level division mistake as A, but sums the per-row margins instead of averaging them: . This has no meaningful business interpretation and inflates the result. D usesAVG([Profit]) / SUM([Sales]), mixing aggregation levels inconsistently. It divides the average profit by total sales , yielding — a number that doesn't represent any useful metric. The key study tip: whenever you need a ratio of totals, always useSUM() / SUM(). Applying division before aggregation (row-level) produces a weighted-average distortion that silently gives wrong answers. - Which calculation correctly produces the required value when Category is not placed on any view shelf? Answer:
SUM(IF [Category] = "Furniture" THEN [Sales] ELSE 0 END)When working with Tableau calculations, you need to understand the difference between row-level and aggregate expressions — this question tests exactly that distinction. Tableau processes calculations at two levels: row-level (evaluated for each underlying transaction row before aggregation) and aggregate (evaluated after rows are grouped into a mark). The key insight here is that when multiple rows are compressed into a single mark, a row-level filter inside aSUMlets you cherry-pick which rows contribute to the total. Option A is correct becauseIF [Category] = "Furniture" THEN [Sales] ELSE 0 ENDruns at the row level — for each transaction row, it returns[Sales]if that row is Furniture, otherwise0. Wrapping this inSUM()then totals only the Furniture values across all rows in the mark, regardless of what other categories are present. This is the classic FIXED-filter-inside-aggregate pattern. Option B is wrong because it places theIFoutside the aggregate. Tableau cannot evaluateIF [Category] = "Furniture"at the mark level when Category is not on a shelf —[Category]is still a row-level field, making this a mixed-level expression that will throw an error. Option C fails for a similar reason:ATTR([Category])returns a single value only if all rows in the mark share the same category. Since a mark contains multiple categories here,ATTR()returns an asterisk (*), so the condition is neverTRUE. Option D has the same structural flaw as C —MIN([Category])picks just one category value from the mark, so marks containing mixed categories will silently return0instead of the correct Furniture total. Study tip: Whenever you need to filter rows before aggregating, put the condition inside the aggregate —SUM(IF ... END)— not outside it. - Which calculation returns total revenue of for the two rows? Answer:
SUM([Unit Price] * [Quantity]), returning When calculating a derived metric like revenue, the order in which you apply aggregations versus row-level calculations matters enormously in Tableau. Ask yourself: does the math need to happen before or after aggregation? Revenue is a row-level concept — for each transaction, you multiply that row's unit price by that row's quantity. Row 1 contributes , and Row 2 contributes , giving a correct total of . Option C,SUM([Unit Price] * [Quantity]), does exactly this: it computes the product for each row first, then sums those products — producing . This is the correct answer. Option A,SUM([Unit Price]) * SUM([Quantity]), aggregates each field independently before multiplying: . This inflates revenue because it treats every unit price as if it applies to every quantity. Option B,AVG([Unit Price]) * SUM([Quantity]), uses the average price of times total quantity of , yielding — closer, but wrong because averaging the price discards the actual price-quantity pairing. Option D,AVG([Unit Price] * [Quantity]), correctly multiplies at the row level but then averages the results instead of summing them: , which understates total revenue. The key study tip: whenever a metric requires multiplying two fields together, always perform the multiplication inside the aggregation —SUM([A] * [B])— not between two separate aggregations. Separating the aggregations breaks the row-level relationship between the fields. - Which calculation returns the proportion of all distinct customers who are online purchasing customers? Answer:
COUNTD(IF [Channel] = "Online" AND [Sales] > 0 THEN [Customer ID] END) / COUNTD([Customer ID])When calculating a proportion in Tableau, you need the right aggregation on both sides of the division: the numerator must count unique qualifying customers, and the denominator must count unique total customers. The key distinction here is betweenCOUNT(counts all rows, including duplicates) andCOUNTD(counts distinct values). The definition states an online purchasing customer has at least one online transaction with sales > 0. Looking at the data: C1, C2, C3, and C4 are all four distinct customers. C1, C2, and C3 have qualifying online-with-sales transactions, but C4's online transaction has zero sales. So the answer should be 3 out of 4, or 0.75. Answer D correctly usesCOUNTD(IF [Channel] = "Online" AND [Sales] > 0 THEN [Customer ID] END)in the numerator, which counts distinct customers meeting the condition (C1, C2, C3 = 3), divided byCOUNTD([Customer ID]), which counts all distinct customers (4). Result: 0.75 ✓ Answer A usesCOUNTin the numerator instead ofCOUNTD, so C1 would be counted twice (two qualifying rows), giving 4/4 = 1.0 — an inflated, incorrect proportion. Answer B flips the aggregation logic:COUNTDon the numerator is right, butCOUNT([Customer ID])in the denominator counts all seven transaction rows, not distinct customers, giving 3/7 ≈ 0.43 — wrong denominator entirely. Answer C inverts the fraction — distinct qualifying customers should be the numerator, not the denominator. This would give 4/3, which exceeds 1.0 and is meaningless as a proportion. Study tip: On Tableau calculation questions, ask yourself two things: "Do I need distinct values?" (useCOUNTD) and "Is the fraction oriented correctly?" Proportion questions almost always requireCOUNTDon both sides, with the filtered condition in the numerator. - Which calculated field applies the threshold at the required level? Answer:
IF SUM([Sales]) > 1000 THEN "High Volume" ELSE "Standard" ENDWhenever you see a question about aggregation in Tableau, ask yourself: at what level of detail does the logic need to apply? Here, the business rule is about combined regional sales — meaning you need a measure that totals all transactions within a region before comparing to the threshold.SUM([Sales])does exactly this. It aggregates every transaction row belonging to a region into a single combined value, then tests whether that total exceeds . If a region has ten transactions of each,SUM([Sales])correctly yields and labels it "High Volume." Option B is the correct answer. Option A usesAVG([Sales]), which computes the mean transaction value. Those same ten transactions of would average to , well below the threshold — a region could have enormous combined sales yet never be labeled "High Volume." Average measures individual-transaction magnitude, not cumulative volume. Option C wraps an innerIF [Sales] > 1000condition inside the sum, which pre-filters out any transaction below before summing. Since the passage explicitly states no individual transaction exceeds , this inner filter eliminates everything, producing a null sum that fails the threshold — the opposite of what you need. Option D usesMAX([Sales]), which returns only the single largest transaction in the region. Like the average, it tests individual transaction size rather than combined volume, so it would never flag a region built on many small transactions. Study tip: On Tableau questions about business thresholds, always map the rule to the right aggregation — if the threshold applies to a total, reach forSUM, notAVGorMAX. - Which calculation returns the required average score of ? Answer:
SUM([Score]) / COUNT([Response ID])When a question asks you to calculate an average with specific rules about missing values, you need to think carefully about what goes in the numerator versus what goes in the denominator — they don't always come from the same field. Here, the business rule is clear: treat null scores as zero and keep all submitted responses in the denominator. That means you need the total score across all responses (nulls counting as zero) divided by the total number of submitted responses. With scores of , null (), and , the numerator is and the denominator is , giving . Option A does exactly this:SUM([Score])ignores nulls in addition but that's fine — Tableau sums — andCOUNT([Response ID])counts all three non-null Response IDs, giving . That's your answer. Option B,AVG([Score]), automatically excludes nulls from both the sum and the count, computing — wrong because the missing response disappears entirely. Option C,SUM([Score]) / COUNT([Score]), has the right numerator butCOUNT([Score])also skips nulls, giving for the same reason as B. Option D,COUNT([Score]) / COUNT([Response ID]), produces , which counts non-null scores rather than summing them — a completely different calculation. The key pattern to remember: whenever nulls must be treated as zero but still counted, you needCOUNTon a field that is never null (like an ID column) as your denominator, notCOUNTorAVGon the value field itself. - What does the calculation
AVG([Sales]) - AVG([Cost])return?Answer: , because each average excludes nulls independently When you see a calculation likeAVG([Sales]) - AVG([Cost])in Tableau, the key is recognizing that each aggregate function operates independently before the subtraction happens. Tableau computes each AVG separately, ignoring nulls only within its own column. Here's how the math works. For Sales, the two non-null values are and , giving . For Cost, the two non-null values are and , giving . The result is , confirming that C is correct. A is wrong because it assumes only rows where both fields are non-null contribute — as if Tableau performs row-level pairing before aggregating. That would be the logic ofAVG([Sales] - [Cost]), a row-level calculation, not two separate AVGs. B is wrong on two counts: it mischaracterizes the operation as summing rather than averaging, and doesn't follow from any valid interpretation of the data. D is wrong because it divides by the number of non-null Sales rows (2) after computing only a single row's difference (), mixing row-level and aggregate logic incorrectly. The critical study tip here: always distinguish between row-level expressions like[Sales] - [Cost](which pairs values before aggregating) and aggregate expressions likeAVG([Sales]) - AVG([Cost])(which aggregates each field independently). This distinction appears frequently on the Tableau exam and is a common source of errors. - What distinct-customer value should Tableau display in the grand total? Answer: , because the distinct count is recomputed across all regions Whenever you see a question about grand totals with
COUNTDin Tableau, remember this core principle: grand totals are not computed from the visible subtotals — they are recomputed from the underlying row-level data. In this scenario, the East region has customers A and B (), and West has customers B and C (). When Tableau calculates the grand total forCOUNTD([Customer ID]), it goes back to the full dataset and counts every distinct customer across all regions: A, B, and C. Customer B appears in both regions but is only counted once, giving you — confirming that D is correct. Choice A assumes Tableau simply adds the regional subtotals (), but that would double-count customer B, who appears in both regions. Summation of subtotals only works correctly for additive measures likeSUM, not for set-based operations likeCOUNTD. Choice B suggests averaging the subtotals (), which has no basis in how Tableau computes grand totals — no averaging occurs here. Choice C claims the answer is because only one customer overlaps between regions, but overlap count is not whatCOUNTDmeasures; it measures the size of the union of all distinct values, not the intersection. A good rule of thumb for the Tableau exam: **COUNTDgrand totals always recompute from scratch on the full data**. If you ever see a question asking what a grand total will display for a non-additive measure, resist the urge to aggregate the subtotals — Tableau doesn't take that shortcut.