Every Power BI interview reaches a moment when the conversation stops being about charts. The candidate has described dashboards, named the visuals they like, walked through a data source or two, and the interviewer nods and changes the subject to the one thing that separates people who have built models from people who have decorated them. The question is rarely dramatic. It is often a single function, mentioned almost casually, and a request to explain what it does. That function, more often than any other, is CALCULATE.

There is a reason for that. Power BI can forgive a plain visual, a crowded page, a slicer in the wrong corner. It cannot forgive a wrong number, and DAX is where the numbers come from. A model with clean relationships and a thoughtful layout will still mislead a room full of managers if its measures misunderstand the context in which they are evaluated. Interviewers know this from experience, usually painful experience: the candidate who looked fluent in the desktop application and then, in the first month on the job, produced a total that changed when somebody clicked a slicer, and could not explain why. DAX questions are not trivia. They are an attempt, in twenty minutes, to find out whether that will happen again.
Filter context is the idea underneath almost everything that follows, and the idea candidates most often think they understand until asked to predict a result. A report page is not a spreadsheet with fixed cells. Every visual, slicer selection, and row and column header quietly assembles a set of filters, and every measure is evaluated inside that set, whether its author thought about it or not. CALCULATE matters because it is the one widely used function that can deliberately change that set — add, remove or replace a filter — before an expression is evaluated. To understand CALCULATE is to understand a measure has no single answer, only an answer for a context. To misunderstand it is to write formulas that work in the one visual tested and fail in every other visual.
This set works through ten questions in that spirit. They begin with the distinctions on which everything else rests — a measure against a calculated column, and row context against filter context — and they build from there, because an interviewer who starts with those two is not being basic. They are checking the foundations before they spend time on the upper floors. A candidate who can explain, with numbers, why the same expression returns one value in a column and another in a measure, and who can say precisely which filters were in force when it did so, has already answered half the questions that will follow. The other half is mostly variations.## The model every answer in this set uses
Good DAX answers need a shared, concrete model, because abstract talk about context convinces nobody. Every worked example in this set uses the same small model — small enough to hold in your head, realistic enough to behave the way a real sales model behaves. When an answer below says a measure returns 1,200 or 46,000, that number comes from the rows described here, and you can check it by hand. Candidates who return to one model let the interviewer watch the context change while the data stays still, which is exactly the point.
**The fact table — Sales**
- **Table name:** Sales
- **Grain:** One row per order line — one product, sold to one customer, on one date, in one transaction
- **Key columns:** OrderID, OrderDate, CustomerKey, ProductKey
- **Value columns:** Quantity, UnitPrice, SalesAmount, CostAmount
- **Scale used in the examples:** Twelve illustrative order lines are spelled out where an answer needs them; totals quoted for the full table treat those lines as the whole table unless an answer says otherwise
- **What to notice:** SalesAmount is stored on the row, so it can be summed directly; margin is never stored, so it must always be derived
**The first dimension — Product**
- **Table name:** Product
- **Grain:** One row per product
- **Key column:** ProductKey
- **Descriptive columns:** ProductName, Category, Colour
- **Categories used in the examples:** Bikes, Accessories and Clothing
- **Products named in the examples:** Road Bike, Mountain Bike, Helmet, Gloves and Jersey
- **What to notice:** Category lives here, not on the Sales row — a filter on Category reaches Sales only through the relationship
**The second dimension — Customer**
- **Table name:** Customer
- **Grain:** One row per customer
- **Key column:** CustomerKey
- **Descriptive columns:** CustomerName, City, Segment
- **Segments used in the examples:** Retail and Corporate
- **Customers named in the examples:** Four retail customers and two corporate customers, introduced by name where an answer needs them
- **What to notice:** Segment is a customer attribute, so a question about corporate sales is a question about a filter travelling from Customer into Sales
**The calendar — Date**
- **Table name:** Date
- **Grain:** One row per calendar day, with no gaps
- **Key column:** Date
- **Descriptive columns:** Year, Month, MonthName, YearMonth
- **Status:** Marked as the model’s date table in Power BI, so time-intelligence functions recognise it as the calendar
- **Range used in the examples:** January through March of a single year, with most worked numbers drawn from January and February
- **What to notice:** OrderDate on Sales relates to Date on this table; every month comparison in the set is a filter on this table, not on the raw order date
**The relationships, in words**
- **Sales to Product:** Many Sales rows to one Product row, joined on ProductKey; the filter direction runs from Product into Sales
- **Sales to Customer:** Many Sales rows to one Customer row, joined on CustomerKey; the filter direction runs from Customer into Sales
- **Sales to Date:** Many Sales rows to one Date row, joined from OrderDate to Date; the filter direction runs from Date into Sales
- **What is deliberately absent:** No relationship runs directly between Product, Customer and Date themselves; they meet only inside Sales, which is why a visual can combine a category, a segment and a month and still produce one coherent number
## Question 1: Measure vs calculated column
### The question as asked
“What’s the difference between a measure and a calculated column in Power BI? When would you use each one?”
It is usually the first DAX question in the interview, often delivered in a tone that suggests a short answer is expected. Resist the implication. The short answer — one is dynamic, one is static — is correct and almost worthless, because it is the answer every candidate gives, including candidates who go on to build calculated columns for things that should have been measures and then wonder why their totals are wrong. The interviewer is listening for whether you can explain the difference in terms of context and storage, and make the practical judgement that follows: given a real requirement, which one do you reach for, and why?
### What the interviewer is really testing
Three things, layered on top of each other. The first is whether you know when each object is evaluated. A calculated column is computed when the data is refreshed, row by row, and its results are stored in the model like any other column of data. A measure is computed at query time, when a visual asks for it, and nothing about its result is stored in advance. That single difference in timing explains nearly every other difference candidates list from memory: file size, refresh time, responsiveness to slicers.
The second thing being tested is whether you understand context well enough to predict behaviour. A calculated column is evaluated in row context — it sees the current row, and it can reach into related tables on the one side of a relationship. It has no filter context of its own, because at refresh time there is no report, no slicer, no visual. A measure is evaluated in filter context — the combined filters from the visual, the page, the report and the user’s selections — and it has no natural current row at all. A candidate who can state that cleanly has the vocabulary for the whole rest of the interview.
The third thing, and the one that decides the grade, is judgement about use. Calculated columns are for values you need to slice, filter, group or place on an axis — a customer age band, a product size label, a flag you want as a slicer. Measures are for values you need to aggregate and respond to selection — total sales, margin, margin percentage, average order value. When a candidate says “I would use a calculated column for a margin percentage,” the interviewer learns something important, and it is not in the candidate’s favour, because a percentage stored row by row cannot be averaged into a correct overall percentage later. The rows do not know what the total is. Only a measure, evaluated against the filtered set as a whole, knows that.
### A full worked answer
Start with the sentence that frames everything, then prove it with the model. A strong answer sounds like this: “A calculated column is evaluated once per row at refresh time, in row context, and stored. A measure is evaluated at query time, in filter context, and not stored. So I use a column for anything I need to filter or group by, and a measure for anything I need to aggregate — and if a value needs to respond to a slicer, it has to be a measure.”
Now make it concrete. On the Sales table, suppose the business wants a line margin figure. As a calculated column, written on Sales, it looks like this:
```dax
LineMargin =
Sales[SalesAmount] - Sales[CostAmount]
```
That formula is evaluated twelve times, once for each order line, at the moment the data refreshes. If the first line sold a Road Bike for 1,000 with a cost of 620, the stored value on that row is 380. If the second line sold a Helmet for 60 with a cost of 25, the stored value is 35. Those numbers are now data. They sit in the model, they consume memory, and — this is the useful part — they can be filtered. You could, in principle, build a slicer from a banding column derived from them, or group lines into high-margin and low-margin buckets. What the column cannot do is change its mind. If a user filters the report to February, the column does not recompute; the rows for January are simply excluded by the filter, and the February rows keep the values they were born with. For a line-level fact like this, that is fine. The margin on a single transaction does not depend on what month you are looking at.
Keep this model in mind as the questions begin. Nothing in it is exotic, and that is deliberate. The difficulty is never the shape of the tables. It is saying, for any given expression, which tables are filtering, which rows are in scope, and what happens to the number when that changes.The same business question, asked at the level a report actually consumes it, is a measure:
```dax
Total Margin =
SUM ( Sales[SalesAmount] ) - SUM ( Sales[CostAmount] )
```
Nothing is stored. When a visual asks for Total Margin next to Category, the engine takes the filter context for each category cell — Product filtered to Bikes, say — applies it to Sales, sums SalesAmount and CostAmount over only the bike lines, and subtracts. Using the illustrative lines in this set, suppose the bike lines total 30,000 in sales against 19,500 in costs, the accessory lines total 9,000 against 4,800, and the clothing lines total 7,000 against 4,200. The measure returns 10,500 beside Bikes, 4,200 beside Accessories and 2,800 beside Clothing, and 17,500 in the total row — and that total is not stored anywhere either. It is the same expression evaluated once more, in the total’s wider context, over all 46,000 of sales and all 28,500 of costs. Click a slicer to the Corporate segment and every one of those numbers is recomputed on the spot, because nothing was ever fixed. That responsiveness is not a feature added to measures. It is what a measure is.
The contrast becomes sharpest with a ratio, and a good answer always includes one, because ratios are where the wrong choice produces a wrong number rather than merely a slow file. Margin percentage as a measure is:
```dax
Margin % =
DIVIDE ( [Total Margin], SUM ( Sales[SalesAmount] ) )
```
For Bikes, that is 10,500 divided by 30,000 — 35.0 percent. For the whole model, it is 17,500 divided by 46,000 — about 38.0 percent. Both are correct, because in each cell the numerator and the denominator are evaluated in the same context. Now imagine margin percentage attempted as a calculated column, each row storing its own little percentage. The Road Bike line stores 38.0 percent, the Helmet line stores about 58.3 percent, and a small Gloves line sold for 20 at a cost of 18 stores 10 percent. If a report then averages that column, it averages the percentages as if each transaction mattered equally — the 20 glove sale counts as heavily as the 1,000 bike sale — and returns a figure that describes no real thing. Worse, it returns it confidently, in the same font as every correct number on the page. This is why interviewers press on ratios. The error is silent.
A complete answer also names the legitimate column cases, because an interviewer is wary of candidates who have learned “measures good, columns bad” as a slogan. Columns earn their place when the value itself becomes a way of cutting the data. A column that labels each Sales line as Small, Medium or Large by its SalesAmount can sit on an axis. A column on Customer that bands customers by city or segment can drive a slicer. In each case the test is the same: do I need to filter, sort, group or display by this value, row by row? If yes, it is a column. Do I need to aggregate it, ratio it, or have it respond to selections made elsewhere? Then it is a measure, and no amount of convenience changes that.
There is a performance footnote worth adding if the interviewer gives you room. Because calculated columns are stored, each one makes the model bigger and the refresh slower, paid for on every refresh whether anyone looks at it or not. A measure costs nothing until a visual asks for it. That is why experienced modelers keep columns few and purposeful — and why “I added a column for each month’s sales” ends interviews early: twelve stored columns doing, rigidly, what one measure does correctly the moment a Date filter is applied.### A common wrong answer autopsy
The wrong answer heard most often goes like this: “A measure is basically a calculated column, but it doesn’t take up space. You use whichever you prefer — I usually make columns because you can see the values in the data view.”
Every clause of that deserves examination, because each one conceals a specific misunderstanding. “Basically the same” erases the difference in evaluation timing, which is the whole subject. A candidate who believes the two are interchangeable will, sooner or later, put an aggregation in a column — SUM typed into a calculated column formula, which, evaluated in row context with no transition, returns the sum of the entire column repeated identically on every row — and will spend an afternoon wondering why every line claims the company’s total sales. “Doesn’t take up space” is true of measures and is the least important thing about them; candidates who lead with storage are reciting a list, not reasoning. And “you can see the values in the data view” reveals the deepest problem: a preference for the object that feels inspectable over the object that behaves correctly in a report. The data view shows you a column exactly once, in no context at all. The report is where numbers meet filters, and a value that cannot survive that meeting was never an answer, only an intermediate step mistaken for one.
**The variant.** The interviewer rephrases: “Fine — so if I want a column in my report that shows each product’s share of total sales, is that a measure or a calculated column?” The trap is the word column, used in its everyday sense of a column in a visual. Share of total is a ratio evaluated against a deliberately widened context — the product’s sales divided by sales across all products — so it is a measure, and specifically a measure that must remove or override the Product filter in its denominator, which is CALCULATE territory and a natural bridge to the harder questions later in the set. Answering “calculated column, because it appears as a column” fails the variant even if the original question was answered perfectly.
**The follow-up.** Expect: “You said a calculated column has row context but no filter context. So what happens if a calculated column references a measure?” This is the interviewer checking whether you know about context transition — that calling a measure from inside a calculated column turns the current row’s values into filters, so the measure is evaluated as if the report had been filtered to that row’s product, customer and date. It is the hinge between this question and the next one, and a candidate who can name it, even briefly, has signalled that the foundations are load-bearing.
## Question 2: Row context vs filter context
### The question as asked
“What’s the difference between row context and filter context? Can you give me an example of each?”
If the first question checks vocabulary, this one checks whether the vocabulary means anything. Almost every candidate can produce definitions. Far fewer can take an expression, a visual and a selection, and predict the number that will appear — which is, in the end, the only DAX skill a business is paying for. Interviewers therefore listen less to the definitions than to the example. A candidate who reaches immediately for a concrete case, with numbers, is telling the truth about having debugged these ideas at midnight. A candidate who stays abstract usually has not.
### What the interviewer is really testing
The core distinction is simple to state and easy to blur. Row context means: there is a current row, and an expression can read the values on that row. It exists in calculated columns, and inside iterator functions such as SUMX, FILTER and AVERAGEX, which step through a table one row at a time. Row context, on its own, does not filter anything. Knowing which row you are standing on is not the same as narrowing the set of rows a calculation considers.
Filter context means: a set of filters is in force, and an expression that aggregates is evaluated over only the rows those filters leave visible. It comes from the visual itself — the category on the axis, the month in the column header — and from slicers, page and report filters, and cross-highlighting from other visuals. A measure always lives in filter context. It has no current row unless an iterator creates one inside it, and even then the two contexts coexist rather than replacing each other.
What the interviewer is really testing is whether you hold both halves of that at once, including the two classic confusions. The first confusion is believing that row context filters related tables. It does not, not by itself: standing on a row of Product does not narrow Sales. Reaching across a relationship from inside row context requires a function built for the purpose, such as RELATED on the one side or RELATEDTABLE on the many side. The second confusion is believing that a filter context gives you a current row to read. It does not: a measure dropped into a visual showing Category cannot simply name SalesAmount, because in the Bikes cell there are several sales rows in scope, not one, and the engine quite properly refuses to guess which one you meant. That refusal is why measures aggregate. The follow-up probes, almost always, are about what happens when the two contexts meet — in an iterator, and in CALCULATE, which can turn a row context into a filter context. A candidate who volunteers that meeting point before being asked has usually answered the next question too.### A full worked answer
Begin with row context in its purest home, a calculated column on Sales:
```dax
LineProfit =
Sales[SalesAmount] - Sales[CostAmount]
```
When the engine evaluates this at refresh, it visits each of the twelve lines in turn. On the Road Bike line — SalesAmount 1,000, CostAmount 620 — the expression reads those two values from the row it is standing on and stores 380. On the Helmet line — 60 and 25 — it stores 35. On a Jersey line — 45 and 27 — it stores 18. Nothing here aggregates, nothing here filters, and nothing about a report a user might later open can change these results. That is row context: a position inside a table, with access to that row’s values, and no opinion about any other row.
Now put filter context beside it, using the plainest measure in the model:
```dax
Total Sales =
SUM ( Sales[SalesAmount] )
```
Place Total Sales in a matrix with Category on the rows and Month on the columns. Consider the single cell where Bikes meets January. Its filter context is assembled from several directions at once: Product is filtered to the products whose Category is Bikes, Date is filtered to the days in January, and if the reader has also set the page slicer to the Corporate segment, Customer is filtered to corporate customers as well. Those filters travel through the relationships into Sales, leaving only the bike lines sold to corporate customers in January visible, and SUM adds the SalesAmount of exactly those lines. If those lines are a Road Bike at 1,000 and a Mountain Bike at 800, the cell shows 1,800. Change nothing in the formula, click the slicer from Corporate to Retail, and the same cell might show 2,400, because different lines survive the filter. The expression did not change. The context did. Any answer to this question that does not make that point, with numbers, has described the machinery without showing it working.
The richest teaching example, and the one to offer if the interviewer asks you to go further, is an iterator, because an iterator is where both contexts operate at the same time. Suppose margin must be calculated line by line — perhaps because a discount rule applies per transaction — rather than by subtracting two totals. The measure is:
```dax
Margin by Line =
SUMX (
Sales,
Sales[SalesAmount] - Sales[CostAmount]
)
```
Read it in two layers. The outer layer is filter context: before SUMX begins, the visual and the slicers have already decided which Sales rows exist for this cell, just as they did for Total Sales. In the Bikes-and-January cell above, only the surviving bike lines are handed to the iterator. The inner layer is row context: SUMX then walks those surviving lines one at a time, and inside its second argument the expression SalesAmount minus CostAmount is evaluated against the current row — 380 for the Road Bike line, then the Mountain Bike line’s own figure, 800 of sales against, say, 510 of cost, giving 290 — and SUMX adds the results as it goes, returning 670 for the cell. Neither context did the other’s job. The filter context chose the rows; the row context did the arithmetic on each onOne more contrast cements the distinction. Take the expression Sales[SalesAmount] on its own. Inside the calculated column, it is perfectly meaningful: it means this row’s amount. Inside a measure, standing alone, it is an error, because filter context supplies a set of rows, not a row. The measure must say what to do with the set — SUM it, AVERAGE it, take its MAX — or create a row context of its own with an iterator. The same three words, valid in one context and invalid in the other, are the cleanest proof that context is not a technicality around DAX. It is DAX.
Finally, a strong answer names the bridge between the two worlds. When a measure is referenced from inside a row context — in a calculated column, or inside an iterator — CALCULATE performs context transition: it turns the current row’s values into filters, so the measure is evaluated as though the report had been filtered to that row. That is why a calculated column containing nothing more than a reference to Total Sales can return a different, row-specific value on every line. You need to know transition exists, because the candidate who insists the two contexts never interact will be contradicted by the very next formula the interviewer puts on the screen.e. Candidates who can narrate an iterator that way, layer by layer, rarely struggle with the harder questions that build on it.### A common wrong answer autopsy
The standard wrong answer runs: “Row context is when you’re working with rows, like in a table visual, and filter context is when the user clicks a filter. So a table visual has row context and a card has filter context.”
The autopsy is instructive. First, context is a property of how an expression is evaluated, not of which visual happens to display it. A table visual showing Sales lines still evaluates each measure cell in filter context — the filters assembled by the page and the row headers — even though the result is drawn in rows on the screen. Confusing the shape of the display with the logic of the evaluation is the original sin from which most DAX bugs descend. Second, filter context is not only what “the user clicks.” The largest part of it is built silently by the visual itself — every axis category, every column header, every legend entry — plus page and report filters the user may never touch. A candidate who thinks filters arrive only by clicking will never suspect the axis when a number looks wrong, and the axis is where the answer usually is. Third, the definition omits iterators entirely, which means the candidate has no account of how SUMX differs from SUM — and an interviewer who hears that omission will often test it on the spot by asking the candidate to predict a SUMX result, at which point the interview, politely, is already decided.
A quieter wrong answer deserves mention too: “Row context filters the row you’re on.” It sounds close, and that is the danger. Row context identifies a row; it filters nothing. Precision here is not pedantry — each such imprecision becomes, in production, a specific and expensive wrong number.
**The variant.** The interviewer shows a measure and asks you to narrate it: “Talk me through what happens, context by context, when this runs in a visual filtered to February.” Choose the SUMX measure above and answer in order — first the February filter context from the Date table narrowing Sales through the relationship, then the iterator creating a row context for each surviving line, then the per-line subtraction, then the sum of those results becoming the cell value. The variant rewards sequence. Candidates fail it not by getting a definition ## Question 3: What Does CALCULATE Do, and What Is Context Transition?
### The Question as Asked
“You keep using CALCULATE in your measures. In plain terms, what does CALCULATE actually do? And can you explain context transition — when does it happen, and why should I care?”
The interviewer will usually ask this right after you have written a filtered total, because almost every candidate can copy a CALCULATE pattern from memory. Far fewer can explain what the engine did with it. Expect a small model on the whiteboard — in this set, the shared model with a Sales fact table, Product and Customer dimensions, and a marked Date table — and a request to predict a number before anyone runs the code. The prediction is the point: if you can predict the result, you understand the function.
### What the Interviewer Is Really Testing
Three things, in order. First, whether you know that CALCULATE is the only function in DAX that changes the filter context in which an expression is evaluated. Filters in a report do not act by magic. Slicers, visual rows and columns, page filters and cross-highlighting all assemble a filter context, and a measure is evaluated inside that context. CALCULATE is how a measure author reaches into that context and modifies it deliberately — adding a filter, removing one, or replacing one — before the expression runs.
Second, whether you understand the two contexts and the bridge between them. Every DAX evaluation happens with a filter context, the set of filters currently in force, and, inside an iterator, a row context, the current row being visited. A row context by itself does not filter anything. Context transition is the moment a row context is converted into an equivalent filter context, and it happens automatically when a measure is referenced inside a row context. Candidates who miss this write measures that return the grand total on every row of a calculated column and cannot explain why.
Third, whether you can reason about overwriting. When CALCULATE receives a filter argument touching a column already filtered by the visual, the new filter replaces the old one for that column, unless you preserve it with KEEPFILTERS. Interviewers test this because it explains a whole class of real-world bugs: a measure showing Bikes inside a visual filtered to Accessories is not broken. It is doing exactly what CALCULATE was told to do.
### The Worked Answer
CALCULATE takes an expression and a list of filter arguments. It evaluates the filter arguments in the original context, builds a new filter context from them, and evaluates the expression in that new context. Nothing else rewrites the context this way, which is why CALCULATE appears in most production measures.
A concrete example on the shared model makes the mechanics visible. Suppose the base measure is deliberately plain:
```dax
Total Sales =
SUM ( Sales[Sales Amount] )
```
On its own, Total Sales respects whatever the visual asks for. Put Product Category on the rows of a matrix and the measure returns the sales for each category, because the row label supplies a filter on Product. Put Year on the columns and it returns each category in each year. The measure has no opinion of its own.
Now give it an opinion:
```dax
Bikes Sales =
CALCULATE (
[Total Sales],
Product[Category] = “Bikes”If intersection is what you actually want, you say so explicitly:
```dax
Bikes Sales Keeping Visual Filter =
CALCULATE (
[Total Sales],
KEEPFILTERS ( Product[Category] = “Bikes” )
)
```
With KEEPFILTERS, the measure filter is intersected with the existing filter on Category. In the Accessories row the intersection of Accessories and Bikes is empty, so the result is blank. In the Bikes row it returns the Bikes total. In the total row, where no single category is selected, it returns the Bikes total. Same base measure, same target value, opposite behaviour — and the only difference is whether the author understood replacement.
The second half of the question is where strong candidates separate themselves. Context transition needs a row context to exist in the first place. Row contexts are created by iterators such as SUMX, FILTER and AVERAGEX, and by calculated columns, which are evaluated row by row when the model is processed. Inside that row context, if the expression references a measure — any measure — CALCULATE is invoked implicitly around that measure reference, and the current row is turned into filters on every column of the row’s table. That conversion is context transition.
The classic demonstration uses a calculated column on the Product table. An analyst, wanting each product’s total sales on the product row, writes:
```dax
Product Total Sales (calculated column) =
[Total Sales]
```
What the column holds is each product’s own sales. Many candidates predict the grand total on every row, and then cannot explain the product-level values they actually got. The explanation is transition. The calculated column is evaluated with a row context for the current Product row. Referencing the measure [Total Sales] triggers an implicit CALCULATE, transition converts that row into a filter — every column of the Product row applied as a filter — and the relationships carry that filter to Sales. The measure is evaluated as if the report had been filtered to just that product: if the current row is the product with Product Key 412, the column returns the sales for product 412 alone.
Change one word and the behaviour changes completely. Write the column with the raw aggregation instead of the measure reference:
```dax
Product Total Sales Without Transition =
### The Common Wrong Answer — and Why It Fails
The wrong answer heard most often is some version of: “CALCULATE is like SUMIF in Excel. It adds up values where a condition is true.” The comparison is understandable and it is dangerous. SUMIF suggests a single condition applied to a single range, with the surrounding worksheet playing no part. CALCULATE does the opposite: its entire meaning depends on the surrounding context, on what it keeps, what it removes and what it overwrites. A candidate who thinks in SUMIF terms will predict intersection where the engine performs replacement, will be baffled by a repeated total in a matrix, and will reach for IF statements to fix behaviour that was never broken.
A second wrong answer defines context transition as “when the filter context changes.” That misses the direction of travel. Filter contexts change constantly — every visual does it. Transition is specifically the conversion of a row context into a filter context, triggered by a measure reference or an explicit CALCULATE inside an iterator or a calculated column. Candidates who give the loose definition almost always fail the follow-up prediction, because their definition gives them no mechanism to work with.
The autopsy, in both cases, is the same. The candidate learned CALCULATE as syntax — a pattern to copy when a filtered total is needed — rather than as the engine’s context machinery. Syntax knowledge survives until the first novel problem. Mechanism knowledge lets you predict a number you have never seen, which is precisely the skill the interview is priced to detect.
### A Variant You Might Get Instead
“Here is a matrix filtered to the year 2025 by a slicer. Inside it, a measure uses CALCULATE with a filter on Date[Year] = 2024. What does the measure show, and how would you make it show 2024 sales alongside 2025 instead of instead of it?” The core of the answer is unchanged: the measure’s filter on Year replaces the slicer’s filter on Year, so the measure shows 2024 everywhere; the alongside comparison is normally built as two separate measures, each pinning its own year, rather than one measure trying to hold two years on the same column at once — unless the author deliberately uses a set of years as the filter, in which case the measure returns the combined total for the set. Candidates who answer with replace## Question 4: SUM vs SUMX — Iterators, Row-by-Row Evaluation and Performance
### The Question as Asked
“When do you use SUM, and when do you use SUMX? They both add things up. What is the actual difference, and does it matter for performance?”
On the shared model the interviewer will often put a number on it immediately: “Sales has a Quantity column and a Unit Price column, but no line amount column. Give me total revenue.” That framing forces the distinction instead of allowing a recitation. If a Sales Amount column already existed, SUM would finish the job in one line. The absence of the column is the question.
### What the Interviewer Is Really Testing
At the surface, the test is whether you know that SUM aggregates a single existing column, while SUMX iterates a table row by row, evaluates an expression for each row in a row context, and adds up the results. Underneath, the interviewer is testing three deeper judgements: that an iterator’s expression can draw on several columns and even measures — with context transition where a measure is referenced — while SUM sees only one column; that you know when row-by-row evaluation is semantically necessary, not merely possible; and that you understand the performance shape of iteration — SUMX is often perfectly fast, and the real costs come from what the expression does per row, especially context transition and nested iteration. Candidates who answer with an unconditional rule — “always use SUM, SUMX is slow” — give themselves away. The interviewer wants the conditions.
### The Worked Answer
SUM is an aggregator. It takes one column and returns the sum of its values under the current filter context:
```dax
Total Sales =
SUM ( Sales[Sales Amount] )
```
There is no row context, no per-row expression, and nothing to decide. If the model already stores the value you need at the grain you need it, SUM — and its siblings AVERAGE, MIN, MAX and COUNTROWS in their respective roles — is the right tool, and it lets the storage engine do what it is exceptionally good at: scanning a compressed column and aggregating it at high speed.
SUMX is an iterator. It takes a table, visits each row, evaluates an expression with that row in scope, and sums the results:
```dax
Total Revenue (Quantity Times Price) =
SUMX (
Sales,
Sales[Quantity] * Sales[Unit Price]
)
```
The expression Quantity multiplied by Unit Price does not exist as a column anywhere in the model. It exists only per row, at the moment of evaluation, which is exactly the gap SUMX fills. Work the numbers on three illustrative rows to make the mechanics undeniable. Row one: Quantity 3, Unit Price $1,200, line value $3,600. Row two: Quantity 1, Unit Price $45, line value $45. Row three: Quantity 7, Unit Price $210, line value $1,470. SUMX evaluates $3,600, then $45, then $1,470, holds each result, and returns $5,115. SUM cannot produce that figure from this model at all, because there is no single column containing $3,600, $45 and $1,470 to be summed. That is the cleanest statement of the difference: SUMX computes the values it then adds; SUM only adds values that already exist.ment first, and design second, handle the variant comfortably.
### The Follow-Up the Interviewer Asks Next
Almost invariably: “So if CALCULATE overwrites, how do I remove a filter instead of replacing it — and what is the difference between ALL and REMOVEFILTERS?” That question is the bridge to percent-of-total work, and it is asked to see whether your CALCULATE knowledge extends past adding filters to the equally important work of taking them away. A good short answer previews it honestly: ALL and REMOVEFILTERS both clear filters inside CALCULATE, with subtle differences in how they behave when used as top-level table functions elsewhere, and the choice between them is the subject of the percent-of-total question later in this set.SUM ( Sales[Sales Amount] )
```
Now there is no measure reference, no implicit CALCULATE, and no transition. A row context does not filter, so SUM simply aggregates the entire Sales table, and every row of the column holds the same grand total — if total sales across all products and years in the model is $81,900,000, then $81,900,000 appears on all several hundred product rows. Two columns that look almost identical produce a per-product result in one case and a constant in the other, and the entire difference is context transition. An interviewer who sees you walk through both versions, with numbers, without prompting, will usually stop worrying about your CALCULATE knowledge.
Two refinements complete a senior-level answer. Transition applies filters for every column in the row, not just the key, so the resulting filter can be narrower than intended — one reason experienced modelers project only the columns they need before iterating. And transition does not cross relationships by itself: it creates the filter, and the model’s relationships propagate it, so a missing or inactive relationship can look like transition failed when the filter simply had nowhere to travel.
)
```
Place Bikes Sales in the same matrix, still broken out by Product Category. A beginner predicts that the Accessories row will show blank, because the visual says Accessories and the measure says Bikes, and the two should intersect to nothing. That is not what happens. The result shows the Bikes total on every row — Accessories, Clothing, Components, all of them — because the filter argument Product[Category] = “Bikes” overwrites the outer filter on that same column. The new filter context for the measure contains Category equals Bikes, regardless of which row of the matrix is being calculated. If the Bikes total for the selected period is, say, $28,450,000, then $28,450,000 iThe same pattern extends well beyond multiplication. Any per-row logic belongs to an iterator or a calculated column. A typical second example is revenue net of a row-level discount stored on the sale itself:
```dax
Net Revenue After Line Discount =
SUMX (
Sales,
Sales[Quantity] * Sales[Unit Price]
* ( 1 - Sales[Line Discount Pct] )
)
```
If a row has Quantity 4, Unit Price $500 and a Line Discount Pct of 0.10, the row contributes 4 times $500 times 0.90, which is $1,800, and the measure returns the sum of those net contributions across whatever rows survive the filter context. Note what did not happen: nobody added a helper column to the fact table to make the arithmetic possible. The iterator carried the logic.
Row-by-row evaluation also matters when the expression references a measure, because that is where context transition enters an iterator. Consider counting, across products, how many products cleared a sales threshold — a question SUM cannot approach:
```dax
Products Over 100K =
SUMX (
VALUES ( Product[Product Key] ),
IF ( [Total Sales] > 100000, 1, 0 )
)
```
VALUES supplies a one-column table of distinct products visible in the current context. SUMX visits each product in turn. On each visit, the reference to [Total Sales] triggers context transition, so the measure is evaluated for that product alone. If that product’s sales exceed $100,000, the row contributes 1; otherwise 0. The sum is a count of qualifying products, computed correctly per product precisely because transition re-filters the measure on every iteration. This example tends to land well in interviews because it shows SUMX, row context and transition working as one mechanism rather than as three memorised definitions — and it quietly revisits Question 3 in applied form.
Performance deserves a straight answer rather than a slogan. SUM over a stored column is generally the fastest shape, because the storage engine can aggregate the compressed column directly. SUMX with simple arithmetic is also handled efficiently, and on models of ordinary business size the difference is rarely what makes a report slow. Iterators become expensive in three recognisable ### The Common Wrong Answer — and Why It Fails
The most common wrong answer is: “They give the same result; SUMX is just the slower, older way of doing it.” On a model where a Sales Amount column already equals Quantity times Unit Price on every row, the two measures do return the same number, and that coincidence is what sustains the myth. The failure appears the moment the model changes. Add a discount column that SUM was never told about, or remove the precomputed amount column, and the equivalence collapses — SUM has nothing to say about a value that is not stored, while SUMX was designed for exactly that case. An interviewer who hears “same result, different speed” hears a candidate who has tested the functions on one convenient model and generalised from it.
A subtler wrong answer runs the other way: reaching for SUMX for everything, including SUMX ( Sales, Sales[Sales Amount] ) where a plain SUM would do. It returns the right number, which is why nobody catches it in a demo, but it signals that the author does not distinguish aggregation from iteration, and in a large model it can forgo the storage engine’s fastest path for no benefit. The autopsy for both errors is identical: the candidate treats the choice as a preference. It is not a preference. It is determined by where the value lives — stored in a column, or computable only row by row.
### A Variant You Might Get Instead
“Total Sales is already a measure built with SUM. Now I need the average of each product’s total sales — the average product performance, not the average line.” This is AVERAGEX territory, and it tests whether you understood SUMX as a family rather than a single function. The shape is AVERAGEX ( VALUES ( Product[Product Key] ), [Total Sales] ): iterate the distinct products, transition the measure per product, and average the per-product totals. If three products in scope total $300,000, $150,000 and $50,000, the result is $166,667 — the average of product totals — which is a different number, answering a different question, from averaging individual sales lines. Candidates who reach for AVERAGE ( Sales[Sales Amount] ) have answered the line question, not the product question, and the gap between the two is the whole variant.
### The Follow-Up the Interviewer Asks Next
## Question 5: Percent of Total — ALL, REMOVEFILTERS and ALLEXCEPT
### The Question as Asked
“In this matrix, each row is a product category. Next to Total Sales, show each category’s percent of the overall total. How do you build that measure — and what changes if I want percent of the year instead?”
It sounds like formatting. It is not. A percent-of-total measure is a ratio of two filter contexts: the numerator respects the visual, the denominator deliberately escapes part of it. Everything turns on which filters the denominator keeps and which it discards.
### What the Interviewer Is Really Testing
Whether you understand that “the total” is not one thing. Total across categories within the selected year, total across years within the selected category, and the grand total are three different denominators, produced by removing different filters. The interviewer is testing whether you reach for ALL, REMOVEFILTERS or ALLEXCEPT as a deliberate choice about scope — not as synonyms — and whether you protect the division with DIVIDE so an empty denominator returns blank rather than an error. A candidate who cannot restate one memorised pattern for a different scope has not passed, however correct the first number looks.
### The Worked Answer
Build the numerator from the base measure and construct the denominator inside CALCULATE by stripping the category filter while leaving everything else — the slicer’s year, the page’s region, any customer filter — untouched:
```dax
Pct of All Categories =
DIVIDE (
[Total Sales],
CALCULATE (
[Total Sales],
REMOVEFILTERS ( Product[Category] )
)
)
```
Work it with numbers. Suppose the slicer selects 2025, total sales for 2025 across all categories is $40,000,000, and the rows are Bikes at $18,000,000, Accessories at $6,000,000, Clothing at $4,000,000 and Components at $12,000,000. In the Bikes row, the numerator is $18,000,000. The denominator removes only the Category filter contributed by the row, so it evaluates Total Sales for all categories, still in 2025: $40,000,000. DIVIDE returns 0.45, formatted as 45.00 percent. Accessories returns 15.00 percent, Clothing 10.00 percent, Components 30.00 percent, and the four shares sum to 100 percent — a quick self-check worth stating aloud. In the matrix total row, numerator and denominator are both $40,000,000, so the total correctly shows 100 percent rather than a sum of percents gone wrong.
ALL does the same job in this position, and candidates should know both forms:
```dax
Pct of All Categories (ALL form) =
DIVIDE (
[Total Sales],
CALCULATE (
[Total Sales],
ALL ( Product[Category] )
)
)
```
Inside CALCULATE, ALL ( Product[Category] ) as a filter argument removes filters on Category, and REMOVEFILTERS is the clearer modern spelling of that intent: it exists only to remove filters, so it cannot be mistaken for a table function. ALL remains essential elsewhere — ALL ( Product ) removes filters on every Product column, ALL () removes filters from all tables, and ALL used outside CALCULATE returns a table of values, a job REMOVEFILTERS does not do. The interview-ready distinction is simple: when the sole purpose is clearing filters inside CALCULATE, REMOVEFILTERS states the intent most readably; when you need the values themselves, or the broadest clearances, ALL is the tool. Either is correct here; confusing their table-returning behaviour elsewhere is the error to avoid.
ALLEXCEPT answers the inverse question. Instead of naming what to remove, it names what to keep, removing filters on every column of a table except the ones listed. Percent of year — each year’s categories measured against a denominator that keeps the year but drops the category — is already what the first measure does, so the sharper illustration is a share within category across years. To show, for Bikes, how its sales split across years, keep Category and remove the rest of the Date filters’ competition by scoping the denominator to the current category:
```dax
Pct Within Category =
DIVIDE (
[Total Sales],
CALCULATE (
[Total Sales],
ALLEXCEPT ( Product, Product[Category] )
)
)### The Common Wrong Answer — and Why It Fails
The classic failure is removing too much: CALCULATE ( [Total Sales], ALL () ) in the denominator of a supposedly within-year share. The arithmetic still produces plausible-looking percents, which is why the bug ships. But the denominator is now the all-years, all-everything grand total — on this model, say $81,900,000 instead of the 2025 figure of $40,000,000 — so Bikes shows roughly 21.98 percent instead of 45.00 percent, the column sums to about 48.84 percent rather than 100, and every reader who adds the column up discovers the error before the author does. The autopsy is a scope error, not a syntax error: the candidate knew a filter had to be removed and removed all of them, because “percent of total” was stored in memory as a single pattern rather than as a question — total with respect to what, holding what constant?
The second failure is dividing by the visual’s own total row value by eye, or hard-coding a total overheard in the meeting. It breaks the moment any slicer changes. A percent measure must recompute its denominator from the model under the current context, minus the specified filters, every time. That recomputation is the entire content of the question.
### A Variant You Might Get Instead
“Now show each subcategory’s percent of its parent category, so every category’s subcategories sum to 100 percent.” The denominator must remove only the Subcategory filter while keeping Category: replace the removal target with Product[Subcategory] in the REMOVEFILTERS form, and the rest of the measure is unchanged. If Road Bikes at $10,800,000 sits inside Bikes at $18,000,000, it shows 60.00 percent, and its sibling subcategories complete the remaining 40 percent. Candi## Question 6: Time Intelligence, the Date Table, and Year-over-Year Growth
### The question as asked
“We have a Sales fact table, a Product dimension, a Customer dimension, and a Date table that we have marked as the date table. Sales Amount is our base measure. Walk me through how you would build year-to-date sales and year-over-year growth. What does the date table actually need to look like for that to work, and what breaks if it does not?”
The interviewer will then narrow it. What if there are gaps in the dates? What if the Date table covers only the years present in Sales? What if the fiscal year starts in April? Those follow-ups are not extra credit. They are the question.
### What the interviewer is really testing
Time intelligence separates people who have built models that survived month-end from people who have only followed tutorials. Anyone can type TOTALYTD and get a number on a demo file. The interviewer wants to know whether you understand why that number is right, when it silently becomes wrong, and what the engine assumes about your Date table.
Three ideas are being tested at once. The first is model hygiene: a separate Date dimension, marked as the date table, contiguous, with a one-to-many relationship to the fact. The second is how the functions work — TOTALYTD, DATESYTD and SAMEPERIODLASTYEAR do not do arithmetic on dates, but return a set of dates, used as a filter inside CALCULATE. The third is judgement about comparison periods: growth looks trivial until last year’s period is incomplete, the current month is still running, or the business reports on a fiscal calendar. Using the date column inside Sales itself also reveals that you do not think in a star schema.
### The worked answer
Start with the Date table, because without it nothing else is reliable. A fit date table has five properties.
- **It is a separate table.** One row per day, in its own dimension, related to Sales on the date key — not the date column in the fact, and not the automatic date hierarchy Power BI creates behind the scenes.
- **It is contiguous.** Every day in its range is present, with no gaps and no duplicates. If it runs from 1 January 2023 to 31 December 2025, it contains all 1,096 days in between, including weekends, holidays and days on which nothing was sold. The time-intelligence functions navigate by moving through this list — shifting a period back a year, or extending it to the start of a year. A missing day breaks that navigation, often producing a blank or a subtly wrong total rather than an error.
- **It covers the full period needed, and a little more.** It must cover every date in any fact it serves, extend far enough back to supply prior periods, and in practice cover complete years, because partial years confuse year-to-date logic at the boundaries.
- **Its date column is a true date, with no time component, and it is unique.** That column is the key. A hidden timestamp will break both the relationship and the uniqueness the engine expects.
- **It is marked as the date table.** Marking tells Power BI to validate the designated column — uniqueness, contiguity, no blanks — and to use this table for time intelligence, applying an implicit all-dates behaviour so filters on other columns of the same table, such as Month Name, do not cut the date range the function is constructing. A time-intelligence function can then reach the full set of dates it needs even when the visual is filtered by an attribute of the same table.
Then add helper columns: Calendar Year, Month Number, Month Name, a Year-Month label such as 2025-03, Quarter, and Fiscal Year and Fiscal Month Number, with Month Name sorted by Month Number and the label by a numeric YearMonth key.
With that table in place, the base measure is deliberately boring:
```dax
Sales Amount =
SUM ( Sales[SalesAmount] )
```
Year-to-date uses CALCULATE with TOTALYTD:
```dax
Sales YTD =
CALCULATE (
[Sales Amount],
TOTALYTD ( ‘Date’[Date] )
)
```
Explain what the function returns, not just its name. TOTALYTD is a shortcut. Underneath, DATESYTD returns a set of dates — from the start of the current year in context up to the last date in context — and CALCULATE evaluates Sales Amount with that set as the filter. Writing the long form once proves you know the shortcut is a shortcut:
```dax
Sales YTD (long form) =Now put numbers on it. Suppose the shared sample model shows these monthly figures, and a visual is filtered to March 2025.
- January 2025: 120,000
- February 2025: 95,000
- March 2025: 140,000
In a March context, Sales YTD is 120,000 plus 95,000 plus 140,000, which is 355,000. In February the same measure is 215,000, and in January it is 120,000. Year-to-date is not a property of the data; it is a property of the filter context. At day level, on 15 March 2025, it runs from 1 January through 15 March — the dates DATESYTD returns for that context — not through the end of March.
Year-over-year growth needs a prior-period measure first, and building it in two steps rather than one is itself a mark of care. SAMEPERIODLASTYEAR takes the dates in context and shifts them back one year:
```dax
Sales PY =
CALCULATE (
[Sales Amount],
SAMEPERIODLASTYEAR ( ‘Date’[Date] )
)
```
In a March 2025 context, it returns the corresponding dates in March 2024 — the whole month, or 15 March 2024 if the context is a single day. If March 2024 sales were 125,000, Sales PY returns 125,000 even though the visual shows 2025. The measure has not travelled in time; it has evaluated the same base measure under a different set of dates.
Growth is then a safe division, which previews the next question:
```dax
Sales YoY Growth =
VAR CurrentSales = [Sales Amount]
VAR PriorSales = [Sales PY]
RETURN
DIVIDE ( CurrentSales - PriorSales, PriorSales )
```
With March figures of 140,000 against 125,000, growth is 15,000 divided by 125,000, or 12.0 percent. Year-to-date growth uses the same shape: 355,000 against 310,000 for the same period in 2024 is 45,000 divided by 310,000, about 14.5 percent. Build a small family of measures all branching from the one base, so a later change to the base flows through the whole family.
A careful answer ends with the comparison trap. If today is 15 November, the current month has fifteen days and last November has thirty; a direct comparison will look disastrous and be meaningless. Compare year-to-date against the same period last year, or restrict both periods to the days elapsed.
### The common wrong answer, and why it fails
The wrong answer heard most often builds year-to-date from the fact table’s own date column, leans on the automatic date hierarchy, and never mentions the Date table at all. It might filter Sales where the year of the sale equals the current year in context and the sale date is on or before the maximum sale date. On a tidy demo it returns 355,000 for March and the candidate relaxes.
It fails in three places. First, it depends on dates present in the fact: days with no sales are missing, so the range is not contiguous, and shifting it back a year lands on whatever sale dates exist rather than the true calendar period. Second, it cannot answer for a month in which nothing was sold — no row, no context — so it returns blank where the business expects zero or a carried figure; a separate Date table on the axis solves that. Third, it collapses when a second fact arrives, with its own dates, because there is no shared calendar. Time intelligence is a calendar problem before it is a formula problem. A quieter wrong answer uses a gapped Date table, left by an inner join to the fact, then blames TOTALYTD for the blanks that broken navigation produces.
### A variant: the fiscal year that starts in April
The variant arrives in almost every real interview, because almost no business reports only on the calendar year. “Our fiscal year starts on 1 April. April 2025 belongs to fiscal year 2026. Build fiscal year-to-date.”
Two changes are needed, kept distinct. First, in the Date table: Fiscal Year and Fiscal Month Number columns, where April is fiscal month 1 and the following March is fiscal month 12, with Fiscal Year labelled by the business’s convention — the point is to ask, and be consistent. Second, in the measure: both TOTALYTD and DATESYTD accept a year-end date, and for an April start the year ends on 31 March:
```dax
Sales Fiscal YTD =
CALCULATE (
[Sales Amount],
DATESYTD ( ‘Date’[Date], “31/3” )
)
```
In a context of February 2026, that measure sums from 1 April 2025 through February 2026, rather than from 1 January 2026. The year-end string is the hinge; candidates who omit it have built calendar year-to-date and relabelled it. SAMEPERIODLASTYEAR still shifts those fiscal dates back a calendar year, landing on t## Question 7: Variables, DIVIDE, and What BLANK Really Does
### The question as asked
“Here is a margin measure someone on the team wrote. It repeats the same sales calculation three times, divides with the ordinary division operator, and occasionally shows an error or a strange infinity in the visual. Rewrite it properly. While you are at it, explain what a variable actually does in DAX, and what happens when part of the calculation is blank.”
The code shown is usually some version of a gross margin percentage in which sales minus cost is divided by sales, with each sum written out in full wherever it is needed.
### What the interviewer is really testing
This looks like a style question and is really a semantics question. Variables are tested on three points: a variable is evaluated once, where it is defined; it keeps that defining filter context; and it is a constant for the rest of the measure — it cannot be re-filtered or changed by a later CALCULATE. Candidates who believe a variable is like a spreadsheet cell, updating whenever context changes, will write measures that are wrong exactly where it matters, such as comparing a value in the current context with the same value in a modified context.
DIVIDE tests whether you know why safe division exists: it handles a zero or blank denominator by returning blank, or a third argument you supply, instead of an error or infinity. Blank handling tests whether you understand that BLANK is not zero, and that blank, zero and an error in a visual are three different statements to a reader.
### The worked answer
Begin with the rewrite. The tangled original reads like this:
```dax
Gross Margin Pct (original) =
( SUM ( Sales[SalesAmount] ) - SUM ( Sales[CostAmount] ) )
/ SUM ( Sales[SalesAmount] )
```
The rewritten version names the pieces, computes each once, and divides safely:
```dax
Gross Margin Pct =
VAR TotalSales = [Sales Amount]
VAR TotalCost =
SUM ( Sales[CostAmount] )
VAR GrossMargin = TotalSales - TotalCost
RETURN
DIVIDE ( GrossMargin, TotalSales )
```
Then explain VAR and RETURN. Each VAR introduces a name and binds it to the value of an expression; RETURN gives the final expression, which may use any name defined above it. Variables can build on earlier variables, as GrossMargin builds on TotalSales and TotalCost, and a variable may hold a table as well as a scalar — the foundation of many advanced patterns.
First, a variable is evaluated once. TotalSales is computed a single time in a given filter context, and every later reference reuses that stored value. That is a performance point — the repeated sum in the original could be evaluated several times — and a readability point: the formula reads as a short story with named characters rather than one dense line.
Second, and most important, a variable keeps the context in which it was defined. This is the sentence the interviewer is waiting for. Consider a share-of-total measure:
```dax
Sales Share of All Products =
VAR CurrentSales = [Sales Amount]
VAR AllProductSales =
Worked numbers keep the answer honest. In a context filtered to one customer segment, suppose Sales Amount is 200,000 and total cost is 150,000. GrossMargin is 50,000, and DIVIDE returns 50,000 divided by 200,000, which is 0.25, shown as 25.0 percent. Now filter to a new segment with cost of 8,000 against a product that has not yet sold. TotalSales is blank, and the division must not error on a published report: with DIVIDE, a blank or zero denominator yields blank, an empty cell rather than an infinity symbol. If the business would rather see a zero, DIVIDE takes a third argument:
```dax
Gross Margin Pct (with fallback) =
VAR TotalSales = [Sales Amount]
VAR GrossMargin = TotalSales - SUM ( Sales[CostAmount] )
RETURN
DIVIDE ( GrossMargin, TotalSales, 0 )
```
That third argument is a design decision, not a default, because a fallback of zero asserts the margin was zero — a claim about the business. Blank says no sales took place. Zero says sales took place and none of the value survived as margin. A strong candidate says that distinction out loud.
Which leads to BLANK behaviour — four facts.
- **BLANK is not zero, but arithmetic often treats it as zero.** Blank plus 5 returns 5, and blank minus 8,000 returns negative 8,000 — why a measure can show a cost with no matching sale without erroring.
- **Division is where blank bites.** A blank or zero denominator with the ordinary operator produces an error or infinity, the defect in the original measure. DIVIDE converts that into a controlled blank or fallback.
- **Comparisons have their own rules.** Blank equals zero, and blank equals an empty string, in DAX comparison logic. The reliable test is ISBLANK.
- **Blank propagates through many functions, but not all.** A blank measure disappears from many visuals by default — usually desired for growth with no prior period, occasionally disastrous for a count that should display zero. Forcing a zero should be a deliberate choice, not a blanket habit.
The error and the infinity were never a data problem; they were the predictable output of the raw operator meeting a zero or blank denominator.
### The common wrong answer, and why it fails
The classic wrong answer treats a variable as a live reference. The candidate defines a variable for sales, places it inside a CALCULATE with a new filter, and expects it to update — producing a share measure in which numerator and denominator are identical and every row reports 100 percent. The autopsy is the defining-context rule: the variable was evaluated once, where it was defined, and no later context shift can reach inside it. The repair is a second variable defined inside the CALCULATE, as in the share example above.
A second wrong answer guards division with a hand-built test for a zero denominator, then divides with the raw operator in the other branch. It evaluates the denominator twice, reads poorly, and usually mishandles blank because the author tested only for zero. DIVIDE handles both and states the intent in one word.
A third wrong answer says only that variables improve performance. That is partly true, but misses the semantic point the question exists to test.
### A variant: the variable that holds a table
The variant that separates senior answers is a variable holding a table. “Store the customers who bought this year, then count how many also bought last year.”
```dax
Returning Customers =
VAR BuyersThisYear =
VALUES ( Sales[CustomerKey] )
VAR BuyersLastYear =
CALCULATETABLE (
VALUES ( Sales[CustomerKey] ),
SAMEPERIODLASTYEAR ( ‘Date’[Date] )
)
VAR Returning =
INTERSECT ( BuyersThisYear, BuyersLastYear )
RETURN
COUNTROWS ( Returning )
```
Every scalar principle still applies: each variable is materialised once, in its defining context — the CALCUL## Question 8: RANKX, Ties, and Why Rank Belongs to the Context
### The question as asked
“Rank our products by Sales Amount. Then rank customers within each region. Tell me what happens when two products tie, how you would show only the top ten products, and why the rank you calculate in a measure changes from visual to visual while a rank stored in a calculated column does not.”
It is three questions wearing one coat, testing the same idea: rank is not a property of a product. It is a property of a product inside a particular comparison set, under a particular filter.
### What the interviewer is really testing
RANKX is the function candidates most often produce from memory and least often explain correctly. The interviewer is testing its first two arguments above all: the table over which ranking happens, and the expression evaluated for each row of that table in turn. That mechanism — iterate a table, evaluate an expression in each row’s context, compare the current value against the list — explains ties and the measure-versus-column difference alike. Handling ties is a business decision disguised as a parameter.
### The worked answer
Start with the plain product ranking, in a measure, and narrate the arguments as you write them:
```dax
Product Rank =
RANKX (
ALL ( Product[ProductName] ),
[Sales Amount]
)
```
RANKX takes, in order, a table, an expression, an optional value, an optional order, and an optional ties rule. Here the table is all product names, with the filter on ProductName removed by ALL so every product is in the comparison set even when the visual shows only a few. For each name in that table, RANKX evaluates Sales Amount in that product’s context, building the league table; it then evaluates Sales Amount in the current context and returns its position, largest first by default. If five products have sales of 90,000, 75,000, 75,000, 40,000 and 10,000, the default ranks are 1, 2, 2, 4 and 5.
Pause on the ALL, because it carries the central lesson. Without it, the table argument is the names surviving the current filter — in a visual showing one product per row, the comparison set can collapse to the visible row alone, and every product reports rank 1. The set must be stated explicitly: ALL ranks against every product, ignoring slicers; ALLSELECTED ranks within the user’s current selection, which is what most users mean when they filter to a category and still want a meaningful 1, 2, 3. Asking which the report needs is senior behaviour.
Ties come next, governed by the fifth argument. The two options are SKIP, the default, and DENSE.
- **SKIP** leaves a gap after a tie, like places in a race. Two products tied at rank 2 are followed by rank 4, because three products sit ahead of or level with the next one. In a list of five products with one tie, the largest rank is still 5.
- **DENSE** leaves no gap. The same five products rank 1, 2, 2, 3 and 4. The largest rank equals the number of distinct sales values, not the number of products.
Neither is correct in the abstract. SKIP suits a league table; DENSE suits banding and some bonus schemes. The full call, with order and ties stated explicitly, looks like this:
```dax
Product Rank (dense) =Ranking customers within each region changes only the comparison set. The rank must restart in every region, so the table argument must be the customers of the current region, not all customers everywhere:
```dax
Customer Rank in Region =
RANKX (
ALL ( Customer[CustomerName] ),
[Sales Amount]
)
```
Used in a visual grouped by Region, that measure needs care. ALL on CustomerName removes the customer filter so all customers enter the set, while the Region filter, arriving from a different column, remains and confines the competition to the current region: the expression is evaluated for each customer under the surviving region context, and customers outside the region return blank sales and fall away. The general principle: to rank within groups, shrink the table argument to the group; to rank overall, widen it.
Top N follows directly, and there are two patterns to offer, with their trade-off. The simple pattern reuses the rank measure as a filter:
```dax
Is Top 10 Product =
IF ( [Product Rank] <= 10, 1, 0 )
```
Place that measure on the visual’s filter pane set to 1, or filter the visual on Product Rank itself, and only the leaders appear. Its weakness is ties at the boundary: if products tie at rank 10, the filter may show more or fewer than ten rows, and the business must decide whether a tie at the cut-off is included or broken. The dedicated pattern uses TOPN, which returns a table rather than a position:
```dax
Top 10 Products Sales =
VAR TopProducts =
TOPN ( 10, ALL ( Product[ProductName] ), [Sales Amount], DESC )
RETURN
CALCULATE ( [Sales Amount], TopProducts )
```
TOPN can return more than ten rows when tenth place is tied, because it returns every row tied at the boundary value. Performance belongs here too: RANKX evaluates its expression for every row of the table argument, for every row of the visual, so ranking ten thousand customers is genuinely expensive. Rank over the smallest table that expresses the set, prefer TOPN when only leaders are needed, and never nest one RANKX inside another.
Finally, the measure-versus-column contrast, the heart of the question. The same RANKX in a calculated column on Product is evaluated once, at refresh, with none of the report’s filters present. It freezes one ranking: all products, all time, all customers. Put a slicer on 2025 and the column still reports the all-time rank, because a column is stored data. The measure is evaluated at query time in each visual’s filter context, so it re-ranks for 2025, and within a category when the visual groups by category. That difference is not an inconsistency to fix; it is the definition of rank doing its job. The column version is legitimate only for a fixed, refresh-time ranking, such as a printed all-time league table.
### The common wrong answer, and why it fails
The signature wrong answer omits ALL, ranks only the products visible in the current filter, and produces a column of ones. The candidate then sorts the visual descending and calls the row position a rank. Sorting is not ranking: it assigns no value you can filter on, survives no export, and says nothing about ties. The autopsy is the comparison-set rule — give RANKX the wrong table and its arithmetic is faithfully, uselessly correct.
A second wrong answer builds the rank in a calculated column because the demo data made it look stable, then cannot explain why the column ignores the year slicer. Rank is not an attribute of a product. It is an answer to a question about a set, and when the set changes, the answer must change with it.
A third wrong answer forces unique ranks by adding a tiny hidden fudge to the expression. Two products with identical sales are then presented as better and worse, and the fudge breaks when it collides with real values. Ties are information: SKIP or DENSE, chosen deliberately and explained, is the professional handling; an openly declared secondary sort key is acceptable where the business demands a single winner.
### A variant: rank last year, side by side with rank this year
The variant interviewers reach for is movement. “Show this year’s rank and last year’s rank for each product, and the change.” It composes the prior-period machinery of Question 6 with the ranking machinery of this question, and it works only if the ranking expression itself is time-shifted, not merely the sales value:
```dax
Product Rank PY =
RANKX (
ALL ( Product[ProductName] ),
CALCULATE ( [Sales Amount], SAMEPERIODLASTYEAR ( ‘Date’[Date] ) )
)
```
```dax
Rank Change =
VAR CurrentRank = [Product Rank]
VAR PriorRank = [Product Rank PY]
RETURN
IF (
NOT ISBLANK ( CurrentRank ) && NOT ISBLA## Question 9: Inactive relationships and USERELATIONSHIP
### The question
Your model has a Sales fact table with two date columns, Order Date and Ship Date. Both columns are related to the same Date table, but only one relationship can be active. A stakeholder asks for a page that shows sales by order date in one visual and sales by ship date in another, on the same page, using the same Date table. How do you build it, and how do you make sure a reader is never confused about which date a number is using?
A variant of the question names the pattern directly: you have a role-playing dimension. Explain what that means in Power BI, why you cannot simply activate both relationships, and show the DAX that makes the inactive relationship work.
### What they’re really testing
First, they want to know that you understand why only one relationship between two tables can be active at a time. An active relationship is the path the engine follows by default when it propagates filters from the dimension to the fact. If two paths between the same pair of tables were both active, a filter on the Date table would arrive at Sales by two routes at once, and the engine would have no principled way to decide which route a given measure meant. Ambiguity is not a cosmetic problem in a semantic model. It changes numbers. So the model allows many relationships between two tables, but insists only one is the default. The rest wait, inactive, until a calculation explicitly asks for them.
Second, they are testing whether you treat role-playing dimensions as a modelling decision rather than a DAX trick. Order date and ship date are not two different kinds of date. They are the same calendar playing two different roles in the business process. An order placed on 28 March and shipped on 2 April belongs to March in one conversation and to April in another, and both statements are true. The interviewer wants to hear you say that plainly, because candidates who see the two dates as unrelated columns tend to build duplicated date tables, disconnected slicers, and pages where two visuals that look comparable are quietly answering different questions.
Third, they are checking discipline. USERELATIONSHIP is powerful precisely because it changes which relationship a single calculation uses, inside that calculation only. Used carelessly, it produces measures with names like Sales Amount 2 and pages where nobody, including the author three months later, can tell which date governs which visual. A strong answer names measures for the role they use, keeps the default relationship as the one the business asks about most often, and makes the choice visible to the reader on the page itself.
### The full worked answer
Start with the model as given. Sales carries an Order Date key and a Ship Date key. The Date table is marked as the date table, with a continuous date column and the usual calendar attributes — year, quarter, month, and the fiscal columns your organisation uses. The relationship from Date to Sales on the order date key is active, because orders are the primary way this business talks about sales. The relationship on the ship date key exists but is inactive. In the model view it is the dashed line, and that dashed line is not an error to be fixed. It is the design.
Your base measure does not change, and it should not mention dates at all:
```dax
Sales Amount =
SUM ( Sales[Sales Amount] )
```
That measure follows the active relationship. Put it in a matrix with Date[Year] and Date[Month Name] and it answers the order-date question, because that is what the model does by default. This is worth saying out loud in the interview: the base measure is already the order-date measure, not because its code says so, but because the active relationship says so. Naming and documentation should make that explicit, so rename it in the report layer or describe it clearly as sales by order date wherever the distinction matters.
The ship-date version is a separate, explicitly named measure that wraps the same base logic in CALCULATE and uses USERELATIONSHIP to tell the engine which relationship to honour for this calculation:
```dax
Sales Amount by Ship Date =
CALCULATE (
[Sales Amount],
USERELATIONSHIP ( Sales[Ship Date], ‘Date’[Date] )
)
```
Read the code the way the interviewer will want it read. CALCULATE evaluates its expression in a modified filter context. One of the things a filter argument can modify is not a column value at all, but the relationship path itself. USERELATIONSHIP, used as a filter argument inside CALCULATE, activates the named relationship for the duration of that calculation and, in doing so, deactivates the relation### The common wrong answer
The most common wrong answer is to go to the model view and activate the second relationship. The candidate either does not notice that activating it deactivates the first, and so silently changes every existing number on every existing page from an order-date basis to a ship-date basis, or believes both can be active and is surprised by the engine’s refusal. Either way, the answer reveals that the candidate thinks of relationships as plumbing to be arranged once, rather than as a default the model declares and individual calculations may override.
A second frequent failure is to duplicate the Date table without being able to say what that costs and when it is worth paying. Duplication is legitimate when roles need independent slicers, but as a reflex it doubles maintenance, invites the tables to drift apart, and breaks the single marked date table the time-intelligence functions rely on.
A third wrong answer reaches for workarounds in the report layer: two pages instead of one, bookmarks that swap visuals, or a measure named Sales Amount Ship that works but sits unexplained beside Sales Amount — correct code, undisciplined model, and a support ticket waiting for its moment.
### Variant
The roles multiply. The same fact now also carries a due date and an invoice date, and the stakeholder wants all four roles available. The answer scales without changing shape: one active relationship for the primary role, three inactive relationships, and one named base measure per role, each a thin CALCULATE wrapper invoking its own USERELATIONSHIP. What does not scale is improvisation. With four roles, the naming convention, the visual titles, and a short model description become the only thing standing between the report and systematic misreading. A strong candidate also raises the alternative honestly at this scale: with many roles and heavy independent slicing, separate role tables may serve better, and they would prototype both before committing.## Question 10: The total is wrong and the report is slow
### The question
A matrix shows margin by product category. The rows look plausible, but the total row does not equal the sum of the rows above it. The same report has also become slow — visuals spin, and a page that used to refresh its numbers in a breath now takes long enough that people go and make tea. Walk me through your debugging. Both problems. In order.
### What they’re really testing
The interviewer is testing whether you debug from principles or from folklore.
On the totals problem, the principle is that a total in a Power BI visual is not the sum of the visible rows. It never was. A total is the same measure evaluated again in a different filter context — the context of the total — and if your measure behaves differently in that context, the total will differ from the row sum, correctly. Candidates who call every such difference a bug are carrying a spreadsheet mental model into a semantic-model tool. Candidates who call every such difference correct reveal something worse, because sometimes the business genuinely does want the sum of the rows, and sometimes the difference exposes a real defect. The interview is listening for the judgement that separates those cases.
### The full worked answer
Begin by reproducing the totals problem in isolation. Take the margin measure out of the busy report page and put it in a plain matrix on a blank page: product category on rows, the measure as the only value, totals on. If the discrepancy survives, you have cleared the page — its slicers, visual-level filters, and interactions — of suspicion, and you are looking at the measure and the model. If it disappears, the fault lives in the page, and you have saved yourself an afternoon.
Now state the mechanism plainly, because naming it is half the fix. Each row of the matrix evaluates the measure with that category in the filter context. The total row evaluates the measure with no single category in the filter context — all categories together. Any measure whose logic depends on the context will therefore give a total that is a fresh calculation, not an addition. Margin is the classic case. Suppose the measure is written as a ratio:
```dax
Margin % =
DIVIDE (
[Gross Profit],
[Sales Amount]
)
```
In a category row, that is the category’s profit divided by the category’s sales — a correct margin for that category. In the total row, it is the whole business’s profit divided by the whole business’s sales. That figure will almost never equal the sum of the row percentages, and it should not, because adding percentages is arithmetic nonsense. The same logic explains averages, distinct counts, and any measure built on a conditional test: a measure that flags categories above a threshold will evaluate that test once more at the total, against the all-categories value, and produce whatever that single test produces. The debugging move is always the same: write down, in words, what filter context each row has and what filter context the total has, then read the measure and predict what it should return in each. When prediction and screen agree, the measure is doing what it was written to do, and the conversation moves to deciding what the business actually wants the total to mean.
That decision is the heart of the answer, so make it explicitly. There are three legitimate outcomes. First, the re-evaluated total is the right answer — for margin percentage, for an overall average, for a distinct count of customers who may appear in several categories and must be counted once in the total. Then the fix is communication, not code: label the total for what it is and explain it with a small worked example. Second, the measure contains a genuine defect — a filter leaking into the total, a guard that blanks it when the business expects a figure, a context transition nobody intended. Then you fix the logic and show before and after. Third, and only third, the business truly wants the total to be the sum of the row values, for an additive presentation of per-row calculations. When that is the requirement, say so, and build it deliberately:
```dax
Margin Amount (Row Sum) =Then turn to performance, and change register from reasoning to measurement. Open Performance Analyzer on the slow page, start recording, and refresh the visuals. Read what it gives you per visual: the DAX query time, the visual display time, and the other time spent waiting. Sort by the worst offender rather than fixing visuals in the order they catch your eye. Copy the worst visual’s DAX query out of Performance Analyzer and run it in DAX Studio, where the server timings show the split that decides your next move — how much time the storage engine spent answering queries, how much the formula engine spent on work the storage engine could not do, and how many storage-engine queries the visual fired at all.
That split organises the investigation. A visual firing hundreds of storage-engine queries usually points back at the measure: iterators over large tables, FILTER over entire tables instead of columns, context transition inside loops, or a SUMX-over-VALUES totals pattern of exactly the kind discussed above, now showing its cost. Heavy formula-engine time with few queries points the same way — the engine is calculating row by row what it should have aggregated. Long storage-engine time on simple queries points instead at the model: very high cardinality columns make every aggregation expensive, and large fact tables joined through bidirectional relationships force extra work propagating filters in directions the queries never needed.
So the model hygiene pass follows the evidence, in a deliberate order. Check cardinality first: columns with near-unique values — timestamps, identifiers, free text carried in as slicers — make every aggregation expensive, and each must earn its place. Check relationships next: bidirectional cross-filtering switched on to make one slicer behave, then left on for the whole model, is among the most common self-inflicted wounds in real reports; the remedy is usually single direction, with the original slicer problem solved inside a measure. Then check for snowflaked dimensions that should be flattened, calculated columns that should have been measures or upstream transformations, calculated tables duplicating fact data, and unused columns and measures bloating the model. Finally, check how data arrives: narrow, cleanly typed columns and transformations folded back to the source are model work even when they happen outside the file.
Close the loop the way you opened it: with measurement. Re-run Performance Analyzer after each significant change, one change at a time, and record the numbers. A story that ends with a stated before-and-after time for the worst visual, and the total row’s meaning agreed with the stakeholder, is the story of someone an interviewer can hand a broken report to on a Monday morning.
### The common wrong answer
For the totals, the common wrong answer is the spreadsheet reflex: declaring the total a bug, checking the addition by hand, and forcing agreement — often with the SUMX pattern applied to every measure in sight, including the margin percentage, producing a total that adds percentages into a number with no meaning at all. Almost as common is the opposite reflex, a shrug that totals are just weird in Power BI, while a genuine defect sits unfixed.
For performance, the common wrong answer is the unsequenced tip list, applied wholesale with no measurement before or after — or blaming data volume and proposing bigger capacity before anyone has established which visual, which query, and which engine is actually slow. Both treat debugging as recall. The scenario rewards treating it as investigation.
### Variant
The total is not merely different from the row sum — it is blank, while every row shows a value. This variant points at a diagnosable family of causes. A measure guarded by a test that only one value is present in context will pass in every row and fail in the total, returning its fallback, very often blank by design. A measure that reads a single value from a column behaves the same way when several values are present. The sequence does not change — reproduce, state each context, predict, compare — but naming the guard pattern from the symptom alone, and asking whether the blank was a deliberate choice the stakeholder has forgotte## What candidates are reporting from the interview room
The first argument is about weight: how much of a Power BI loop is really DAX, and how much is SQL wearing a dashboard’s clothes. Candidates describe loops that opened with window functions and joins and only reached filter context in the final round, and other loops that never asked for a line of SQL at all. Checked against this set, the question is miscast. The set’s questions move constantly between thinking in sets and filters, which SQL teaches well, and thinking in evaluation contexts, which only DAX teaches. A candidate who reasons cleanly about what a filter is doing can learn either syntax quickly; a candidate who has memorised DAX functions without that reasoning stalls on the totals question however the loop is weighted. Prepare the reasoning, and treat both syntaxes as dialects of it.
The second argument concerns format: take-home exercises against live rounds. The take-home camp values working the way the job is actually worked — documentation open, time to test edge cases, a model to explore. The live-round camp counters that take-homes reward whoever has the most free evenings, blur authorship, and stretch loops for weeks, while a live round tests the thinking a team will actually get in a meeting. Candidates report employers drifting in both directions, sometimes splitting the difference with a live walkthrough of take-home work. Against this set, the lesson is that both formats test the same material at different depths of polish. The scenario question in particular is a live format by nature, because its value lies in watching the sequence of checks rather than admiring the final measure. Preparation that only works with unlimited time, or only as memorised recitation, is not finished.
The third argument is about the questions themselves. Some candidates insist generic DAX is enough — filter context, iterators, and time intelligence are the whole game, and tool-specific syntax is trivia. Others report rounds built around particulars: the exact behaviour of one function at a total, the precise argument a relationship function takes. Checked against this set, both reports describe something real. The concepts here are generic — context, iteration, relationships, aggregation — but every worked answer turns on a specific: a function that deactivates one relationship while activating another, a## Three rooms, three interviews
### The retail analyst and the margin that would not add up
Consider a candidate who has spent two years analysing store performance for a regional retail chain, and who is asked, midway through a second-round interview, to talk about the hardest number they ever had to explain. The candidate describes a category margin report used in a Monday trading meeting. The report’s margin column was a calculated column on the sales table, computed row by row at load time, and its category figures looked right every week. Its total, though, was persistently and slightly wrong — not dramatically, just enough that the finance lead had started keeping a private spreadsheet to correct it, which is the moment a report quietly stops being the record and becomes a rumour about the record.
Walking the panel through the diagnosis is where the candidate earns the room. The column had frozen each row’s margin at load time, in the row’s own context, and no slicer, store filter, or promotion filter applied later could change what it had already decided. The total was therefore adding frozen per-row results produced under conditions the meeting was no longer looking at. The rebuild is the distinction this set returns to throughout: margin rebuilt as a measure, profit divided by sales at query time, evaluated fresh in whatever context each visual and each total supplied. The category rows barely moved. The total became the true weighted margin of whatever the meeting had actually selected — and the finance lead’s private spreadsheet, the candidate notes, was retired within a fortnight, which the panel laughs at in the way that means they have all lived some version of it. When a number is wrong in a way that depends on how you look at it, suspect the difference between a value stored per row and a value calculated per question.
### The live round and the two spreadsheets
Consider a candidate in a live round for a reporting role, given a laptop, forty minutes, and a task with a trap folded inside it. The task presents two versions of the same monthly sales spreadsheet, sent by two different regional managers, each insisting theirs is the current one, with totals that disagree by a small but real amount. Before any modelling can start, the candidate has to decide what the data even is — and the interviewer, watching quietly, cares far more about that decision than about the DAX that follows it.
The candidate’s strength, in this telling, is sequencing. Rather than opening the larger file and starting to build, the candidate slows the room down and reconciles the sources first: checking row counts, comparing the customer and product lists for silent additions, and hunting for the handful of rows where the two versions carry different values for the same sale. It is painstaking work to do by eye across thousands of rows, and the candidate says so, observing that a quick way to see exactly where two spreadsheet versions diverge is to compare two spreadsheets side by side, cell by cell, rather than trusting a visual scan of whichever rows happen to be on screen. The hunt finds its culprit in a small set of amended orders — corrected in one manager’s version, left at their original values in the other — plus one duplicated block of rows near the end of the older file. Only then does the candidate build, on the reconciled version, and say explicitly in the walkthrough which version was trusted, why, and what evidence would change the decision. The interviewer closes by asking what the candidate would do if neither version could be verified, and the answer — escalate with the discrepancy quantified, rather than pick the prettier file — is the answer the exercise was designed to find. Tools and DAX both mattered in the round, but judgement about evidence mattered first, and the candidate who modelled beautifully on untrusted data would have failed it while feeling successful.
### The hiring-manager round and the fiscal year that started twice
Consider a candidate in a final round, seated across from the hiring manager and a finance stakeholder who has joined, pointedly, for the last half hour. There is no laptop exercise this time. Instead the stakeholder describes a live grievance: the dashboard’s year-to-date sales figure does not match finance’s year-to-date figure, the difference is not small, and the business has started quoting finance’s number in meetings while the dashboard sits open on the screen. The candidate is asked, simply, what they would do.
The candidate begins by refusing the premise that one number must be a mistake, and asks the question that reorganises the conversation: which year does each figure think it is in? The company’s fiscal year begins in April. Finance’s year-to-date runs from April, correctly, in every conversation they have. The dashboard, in the candidate’s reconstruction, was built with a standard calendar year-to-date calculation — a respectable function, correctly written, faithfully summing from January. For three months of every year the two figures describe different periods entirely, and for the other nine they differ by exactly the first quarter’s sales, which is why the gap had looked so strangely stable. The candidate walks through the repair in the terms this set has used throughout: a year-to-date measure that declares its year-end date explicitly, so the fiscal boundary lives in the code where anyone can audit it, tested against a hand-checked April-to-June figure supplied by finance before it goes anywhere near the dashboard. But the candidate spends as long on the surrounding repair as on the DAX — the relabelle## A seven-day study plan
Ten questions can look manageable on a page and still feel scattered in practice. A candidate reads about CALCULATE on Monday, RANKX on Tuesday, time intelligence on Wednesday, and by Friday the pieces have blurred into a single vague memory of having seen the words before. The plan below prevents that blur by sequencing the ten questions in the order the ideas actually depend on each other, and by pairing every reading session with something built, broken and rebuilt in Power BI Desktop. Reading alone will not carry an interview. The interviewer will ask a follow-up, change a condition, or point at a total that does not add up, and only hands that have made those mistakes in private will answer calmly in public. Set aside ninety minutes to two hours a day. Keep one small, familiar dataset for the whole week — a sales table with dates, products, regions and customers is enough — so that the model stays constant while the thinking deepens. By the end of the week you will not merely have covered ten questions. You will have a single working file that demonstrates all of them, and a set of explanations you have already spoken aloud at least once.
**Day 1 — Filter context first, because everything else stands on it.** Begin with the question candidates most often underestimate: what filter context is, and how it differs from row context. Load your sales data, build a simple star schema with separate date, product and region tables, and place total sales on a matrix by region and by product category. Before writing any new measure, click through the visual and watch how each cell quietly changes the filters that reach the measure. That observation is the lesson. Then write the same calculation two ways, once as a measure and once as a calculated column, and compare what each one returns inside the matrix. The column will carry the value it computed row by row at refresh, indifferent to the slicers you move. The measure will respond. Say that difference out loud, in plain sentences, as if an interviewer had just asked it, because on Day 1 the goal is vocabulary anchored to behaviour you have seen with your own eyes. End the session by deliberately creating row context with an iterator such as SUMX over a small table, printing the intermediate result in a calculated table so you can inspect it. If you can explain, without notes, why the iterator sees one row at a time while the matrix cell sees a filtered set, Day 1 has done its work.
**Day 2 — CALCULATE, practised until it becomes ordinary.** The second day belongs entirely to the most important function in this set. Start with the simplest possible modification: total sales, then total sales for one region imposed by CALCULATE, then total sales with that region removed by ALL. Build each version as a separate measure and place them side by side in the same matrix, so the effect of each filter argument is visible rather than imagined. Next, replace a filter instead of adding to it, using a table filter drawn from your product dimension, and notice how CALCULATE overwrites an existing filter on the same column while adding filters on columns that were not already constrained. That distinction — overwrite on the same column, intersect across different columns — answers a surprising share of real interview follow-ups. Spend the second half of the session on context transition. Take the calculated column you built on Day 1, wrap its logic in CALCULATE inside an iterator, and watch the row context turn into an equivalent filter context. Write down, in your own words, what changed and what did not. Close by timing yourself: explain CALCULATE in ninety seconds, then in thirty seconds, then in one sentence. An interview rarely allows the long version first, and the candidate who can give the short version cleanly earns the right to give the long one.
**Day 3 — Measures, columns and the discipline of choosing correctly.** Day 3 revisits the measures-versus-calculated-columns question, but now as a design decision rather than a definition. Take your Day 1 and Day 2 file and audit it. List every calculated column you have created and ask, for each one, whether its value truly needs to exist row by row at refresh, whether it will be used as a slicer, a filter or an axis, and whether it is consuming memory to store something a measure could compute on demand. Keep the columns that earn their place — a customer segment used for slicing is a legitimate column — and convert the rest into measures. Then do the reverse exercise once, deliberately: build a case where a column is the right answer, such as a static banding of unit price that the business wants to slice by, and defend that choice in two spoken sentences. In the afternoon, practise the performance angle without turning it into folklore. A calculated column is computed once and stored; a measure is computed at query time. Neither is automatically faster or slower in every model, and the stronger interview answer names the trade-off — storage and refresh against flexibility and filter response — instead of reciting a slogan. Finish by rebuilding your matrix from Day 1 using only the cleaned-up fields, and confirm every total still reconciles.
**Day 5 — Ranking, ties and the questions behind the ranking.** Day 5 takes up RANKX, which looks like a small function and opens into a large conversation. Build a ranking of products by total sales, first in the simplest form, then inside a matrix where a region slicer is applied. Watch what happens to the ranks when the visual shows only the top ten products but the measure ranks against every product in the model — the classic gap between ranking what is visible and ranking what exists. Correct it by being explicit about the table RANKX iterates over, using ALLSELECTED where the intention is to rank within the current selection and ALL where the intention is to rank against the whole catalogue. Then force a tie. Adjust or filter your data so two products share the same sales value, and compare the SKIP and DENSE behaviours until you can describe, without hesitation, what each does to the next rank after the tie. Interviewers ask about ties because production reports meet ties constantly, and a candidate who has never seen one will guess. Close the session by combining the week’s work: a measure that returns the sales of the top three products in the current selection, using CALCULATE, a ranking or TOPN filter and the time context from Day 4. It will take several attempts. That struggle is the point — synthesis questions in interviews feel exactly like this, and it is better to meet that feeling at your own desk first.
**Day 6 — Relationships, USERELATIONSHIP and the totals that lie.** The penultimate building day joins two topics that belong together: inactive relationships and totals that do not match the rows above them. Add a second date to your fact table — an order date and a ship date, or a posting date alongside a transaction date — create both relationships to the calendar, leave one inactive, and write two measures that report sales by each date, activating the inactive relationship with USERELATIONSHIP inside CALCULATE for the second. Place them side by side by month and explain, aloud, why the totals agree while the monthly distribution differs. Then turn to the totals problem from the set. Build a measure whose visual total is not the sum of its displayed rows — an average, a distinct count, or a ratio will all do it — and resist the urge to call it a bug. Walk through why Power BI evaluates the measure again in the total’s filter context rather than adding up the cells, and then build the corrected presentation using SUMX over the visible values with HASONEVALUE or a VALUES-based iteration, so the report can show the total a reader expects while you retain the ability to explain both numbers. This is the day that most closely resembles senior-level interview conversation, where the question is rarely a definition and almost always a misbehaving report. Finish by writing, in plain prose, a three-step debugging sequence you would actually follow when a total looks wrong: check the filter context, check the date table and relationships, then check whether the measure is being re-evaluated rather than summed.
**Day 7 — The full rehearsal, and a notebook that makes the next set easier.** The final day is not for new material. Reopen the file you have built across the week, close every note, and work through all ten questions from the set in order, answering each one aloud in under three minutes while performing the relevant step in Desktop rather than describing it from memory. Where an answer stalls, do not reread the whole set — rebuild only that measure, note exactly where the explanation broke, and try again after the remaining questions are done. In the second half of the session, sit a mock interview with the clock visible: one question on CALCULATE, one on time intelligence, one debugging scenario built around a total or a rank, each with a follow-up that changes a cond## Questions readers ask
### Q: How long should I spend preparing DAX before I am ready for interviews?
Most candidates with solid Power BI reporting experience need three to five weeks of focused DAX work, at roughly an hour a day, before the core ideas stop feeling fragile. That estimate assumes you already build reports, understand relationships and can write a basic measure without assistance. If you are newer to Power BI, double it, and spend the first half on modelling — star schemas, relationships and filter flow — because DAX confusion is very often modelling confusion wearing a different name. The honest readiness test is not a calendar date. It is whether you can take an unfamiliar small dataset, build a date table, write a CALCULATE measure with a changed filter, produce a prior-year comparison, and explain each step aloud without reading. When you can also debug a wrong total calmly, by checking filter context before blaming the function, you are ready to interview while you continue learning. Candidates who wait until DAX feels complete wait forever, because the language is deep enough that working analysts keep learning it for years. Aim instead for fluency in the fundamentals covered by this set, one rehearsed debugging routine, and the humility to say how you would investigate a question you cannot immediately answer. Interviewers hire that combination regularly.
### Q: How much does DAX matter compared with SQL in a Power BI role?
It depends on where the role sits, and reading the job description for that signal is itself part of preparation. In a report-developer role, where clean data arrives from a warehouse or a prepared semantic layer, DAX is usually the heavier skill, because the visible quality of the work — correct totals, time comparisons, rankings, measures that survive slicers — is decided in DAX. In an analytics-engineer or full-stack BI role, SQL may carry equal or greater weight, because the same person shapes the tables the model consumes. Most hiring managers, however, test both and watch for a particular failure: a candidate strong in SQL who treats DAX as SQL with different syntax. The two languages think differently. SQL works row by row through a stated sequence of operations on sets you define explicitly. DAX evaluates an expression inside a filter context that the visual, the slicers and the measure itself are all modifying at once. Saying that clearly, and showing you know which tool owns which part of a problem — transformation upstream in SQL or Power Query, dynamic calculation in DAX — is a stronger answer than claiming one language matters more in the abstract.
### Q: Should I memorise DAX functions, or is understanding enough?
Understanding is worth far more than memorisation, but the honest answer is that a small amount of deliberate memorisation supports understanding rather than competing with it. You should know, without looking them up, what CALCULATE, ALL, ALLEXCEPT, ALLSELECTED, FILTER, SUMX, VALUES, HASONEVALUE, USERELATIONSHIP, RANKX and the common time-intelligence functions do, and roughly what arguments each expects. That core vocabulary is small, and fumbling it costs credibility because these are the functions working analysts use daily. Beyond that core, nobody sensible expects recall of the full function library, which runs to hundreds of functions including many specialists use rarely. What interviewers probe instead is whether you can reason about a function you half-remember: what context it needs, what it returns, and how you would test it in a small model before trusting it in a report. The practical method is to memorise by building. A function you have used to solve a real problem in your own file, broken once and repaired, stays with you in a way a flashcard rarely achieves. Keep reference m### Q: What should I do when I blank on a CALCULATE question in the interview?
First, do not fill the silence with a guess dressed as certainty. A short pause, followed by structure, recovers most blanks. Restate what CALCULATE does in the plainest form you can manage: it evaluates an expression in a modified filter context. That single sentence buys you time and is almost always the correct foundation, even when the specific scenario is unfamiliar. Then work the problem in pieces, aloud. Ask yourself what filters are arriving from the visual, what the question wants changed — a filter added, removed or replaced — and which argument would do that. Naming ALL for removal, a table expression for replacement, and USERELATIONSHIP for switching a relationship covers a large share of scenarios, and talking through the pieces often summons the detail that the blank hid. If it does not, say what you would build to test it: a small matrix, the measure in stages, one filter changed at a time. Interviewers consistently rate a candidate who debugs transparently above one who recites a memorised answer and collapses at the first variation. Blanking once will not end your interview. Guessing wildly, then defending the guess, might. Practise the recovery, not just the answers.
### Q: Do I need a portfolio project, or is answering questions enough?
For most Power BI roles, a small portfolio changes the interview more than another week of question practice, because it converts claims into evidence. It does not need to be large. One well-built report on a public dataset — sales, public health, sport, transport — with a clean star schema, a proper date table, and a dozen thoughtfully written measures will do more work than a sprawling file you cannot explain. Choose measures that demonstrate the ideas in this set: a CALCULATE measure that changes filter behaviour deliberately, a year-on-year comparison, a ranking that handles ties, and one measure where you can explain the total’s behaviour. Publish or present it so a hiring manager can open it without friction, and write a short accompanying note, in plain language, describing two problems you hit and how you solved them. That note is frequently read more closely than the report. During the interview, the portfolio gives you somewhere honest to go when a question touches something you have built: you can describe a real decision, a real trade-off and a real mistake. Candidates who have only rehearsed answers sound fluent until the second follow-up. Candidates who have built something can keep talking, because they are remembering rather than performing.
### Q: Is the PL-300 certification worth getting for Power BI interviews?
The PL-300, Microsoft’s data analyst certification, is worth having in the specific ways certifications are usually worth having, and not worth having in the way candidates sometimes hope. It will not substitute for being able to write and explain DAX under questioning, and experienced interviewers know that certificate holders vary widely in practical fluency, so they will test you anyway. What it does provide is real. It gets a resume past screening filters that list it, it gives early-career candidates a structured syllabus that covers modelling, Power Query and governance alongside DAX rather than letting them study only the parts they enjoy, and it signals to an employer that you finished something verifiable. The strongest sequence is to prepare for interviews and the certification together, letting each discipline the other: the exam’s breadth corrects the narrowness of interview sets, and interview practice corrects the exam’s tendency toward recognition rather than construction. If cost or time forces a choice, choose demonstrable skill first and the certificate second, and say so confidently if asked. If you do take it, treat the result honestly either way — a passed exam mentioned briefly is professional; a failed attempt discussed with what it taught you is more credible than candidates expect.
### Q: How does this DAX set connect to data-engineering interviews?
More directly than candidates often assume, because the boundary between BI development and data engineering has thinned as semantic models have become shared infrastructure rather than personal report files. In a data-engineering-leaning interview, the same DAX knowledge is tested from the other side of the relationship. Instead of asking only whether you can write a measure, the interviewer## Sources and further study
Use these sources to check your work during the week above and to go deeper once the set feels familiar. Work through them actively — build alongside the videos, and test every reference example in your own file rather than reading it as settled truth.
- **Microsoft Learn DAX reference** — the official function-by-function reference for the DAX language, including CALCULATE, the filter and time-intelligence functions, and the context rules this set depends on. Keep it open during practice sessions and consult it whenever a function’s argument order or return behaviour is in doubt.
- **SQLBI DAX guidance** — the long-running body of articles, patterns and courses from SQLBI, including their DAX introduction and pattern library for time intelligence, ranking and totals. Their explanations of filter context and context transition are the standard next step after this set, and their patterns repay slow, hands-on study.
- **Pragmatic Works, Power BI interview DAX session on YouTube** — a practitioner-led interview preparation session working through common DAX questions in the format candidates actually face them:
- **TechBrothersIT, DAX fundamentals and filter context session on YouTube** — a fundamentals session centred on DAX basics and filter context, useful for revisiting Day 1 and Day 2 material with worked examples on screen:
- **Pragmatic Works, “DAX That Gets You Hired” on YouTube** — a focused session on the DAX topics employers screen for, well suited to a final review before an interview:
A week from now, the file you built will matter less than the habits it installed: check the context before the function, build the date table before the time calculation, and explain the total before you trust it. Keep practising in small sessions, keep returning to the questions you found hardest, and walk into the interview ready to show your working as readily as your answers. Good luck — and tell us, in the comments, which of the ten questions caught you out first, so the next set can meet readers where they actually stumble. asks whether the model you are handed deserves the measure — whether the grain is right, whether the date dimension is conformed, whether a calculation belongs upstream in SQL or a transformation layer rather than being repeated in DAX across forty reports. Your answers improve noticeably when you can argue placement: aggregated, governed and reused logic often belongs in the pipeline or a shared semantic model, while context-dependent calculation — the ranking that changes with the slicer, the comparison that follows the selected period — belongs in DAX precisely because it must respond to filter context. Candidates who understand both sides can also discuss performance in engineering terms, tracing a slow measure back to cardinality, unnecessary columns or a bi-directional relationship someone added to make one visual work. That conversation, held comfortably, is what separates a report builder from someone a data platform team wants beside them.aterial open during practice, close it during rehearsal, and let the gap between those two settings show you what still needs work.
### Q: I use a Mac and cannot run Power BI Desktop. How should I practise?
This is a real constraint, and it deserves a practical answer rather than sympathy. Power BI Desktop remains a Windows application, so Mac-based candidates have four workable routes. The first is the Power BI service itself: with an appropriate licence you can build and edit semantic models and write measures in the browser, which covers most of the practice in this set, including CALCULATE, time intelligence and ranking, even if the experience is less comfortable than Desktop. The second is a virtualised or hosted Windows environment, through tools such as Parallels on Apple silicon or a cloud Windows desktop, which gives you the genuine Desktop experience for a focused preparation period. The third is a borrowed or library Windows machine for the two or three longest building sessions, paired with browser-based work for daily practice. The fourth, which should support rather than replace the others, is DAX Studio and online DAX editors for testing expressions against a connected model. What matters is that you arrive able to demonstrate the thinking, and honest about your setup. Mention the constraint plainly if asked, describe how you practised, and never pretend to Desktop fluency you do not have — interviewers detect that within two follow-up questions.ition. The follow-up is where the week pays off, because you have spent six days changing conditions yourself. Then, before you close the file, spend twenty minutes turning the week’s scattered notes, screenshots and corrected measures into a personal question-and-answer notebook you will actually return to — one entry per question, the wrong answer you first gave, the measure that finally worked, and the sentence you would say in the room. Keeping that record in VaultBook or any tool you will genuinely maintain matters less than the habit itself: a searchable notebook of your own mistakes and corrections compounds, because the question you missed on Day 2 becomes the example you reach for in the interview, and the next set of questions starts from your recorded reasoning rather than from a blank page. End the week by saving a clean copy of the file, listing the two questions you would still least like to be asked, and scheduling one short session next week for those two alone. Preparation that names its own gaps is preparation an interviewer can trust.**Day 4 — Time intelligence, with an honest date table.** Midweek is for the questions that fail most often for an avoidable reason: a broken or missing date table. Build a dedicated calendar table covering every date in your data with no gaps, mark it as the date table, and relate it properly to the fact table. Only then write the year-to-date, prior-year and rolling calculations from the set. Build total sales, sales year to date with TOTALYTD, same-period-last-year sales with SAMEPERIODLASTYEAR inside CALCULATE, and a year-on-year growth measure that divides safely and returns blank rather than an error when the prior year is absent. Place all four on a matrix by month and read down the columns. The prior-year column should lag exactly as expected, the growth column should be blank where there is nothing to compare, and the year-to-date column should reset each January. If any of those behaviours is wrong, do not move on — debug it today, while the model is small. The most common causes are a date table with gaps, a relationship on the wrong column, or a filter applied to the fact table’s own date column instead of the calendar. End the day by adding a rolling three-month average with DATESINPERIOD, because rolling windows are where interviewers test whether a candidate understands that time intelligence is filter manipulation over a date table, and nothing more mysterious than that.d visual that names its period in its title, the short note to the meeting’s regulars explaining that the old figure was not lying but answering a different question, and a standing check each quarter that dashboard and finance still agree at a period boundary. The stakeholder’s closing remark, in this telling, is that nobody had previously explained the discrepancy as two right answers to two different questions. That is the note this set ends on as well. Most numbers that cause trouble in real organisations are not wrong. They are correct answers, carefully computed, to questions nobody realised were being asked — and the work, in the interview room and after it, is learning to hear the question inside the number. guard that blanks a total, an iterator chosen for one business meaning and refused for another. Generic understanding tells you what kind of thing must be happening; specific syntax is how you prove it, in code, before the interviewer moves on.
The fourth theme is not an argument but a confession, repeated often enough to count as consensus: the totals question is where candidates stumble most. Not time intelligence, not relationships — the total that refuses to equal the sum of its rows. The reasons are instructive. The problem looks elementary, so it invites a fast answer. The fast answer is the spreadsheet answer. Delivered confidently in the first minute, it closes off the reasoning the question exists to open, leaving the candidate defending a SUMX pattern for a margin percentage while the interviewer waits. This set places that question last and gives it the longest walkthrough for exactly that reason. Practise saying, slowly and in order, what context each row has, what context the total has, and what the measure therefore does in each — until the explanation is boring to you. Boring, in that answer, is what correct sounds like.n or a defect to repair, shows the pattern recognition real debugging runs on.
### Follow-up
Expect two follow-ups, one per half. On totals: if the stakeholder insists the total must match the row sum for the margin percentage itself, what do you do? You do not quietly build a meaningless number. You show, with two categories and small figures, what adding percentages produces against the weighted total margin, and offer the defensible presentations — the correctly re-evaluated total, a suppressed total for that measure, or the row-sum treatment applied to the additive amounts underneath rather than to the ratio. On performance: if the worst query is already simple, storage-engine bound, and still slow, look to the model’s physical shape — cardinality, column width, relationship design, and whether the data should arrive pre-shaped — before capacity or refresh architecture, with timings attached to each claim.
SUMX (
VALUES ( Product[Category] ),
[Margin Amount]
)
```
Explain the machinery as you present it. VALUES returns the categories present in the current filter context — in a row, one category; in the total, all of them. SUMX iterates those categories, evaluates the inner measure once per category, and adds the results. The total is now, by construction, the sum of the rows. Attach the warnings immediately: this pattern is slower than a simple aggregation, it needs care with hierarchies and show-items-with-no-data settings, and it is actively wrong for ratios and distinct counts, where the re-evaluated total was the truthful one. Offered as a universal cure, SUMX over VALUES fails the question. Offered for one named business meaning, after ruling out the other two outcomes, it passes.
### Follow-up
Expect to be asked what happens when two USERELATIONSHIP arguments appear in one CALCULATE for two different role pairs, or when the visual also filters on a fact column. The answer they want is composure about scope: each USERELATIONSHIP governs the relationship it names, for that calculation, and unrelated relationships are untouched. If asked why the engine forbids two active relationships, return to the principle you opened with — a semantic model exists so that a number means the same thing to everyone who reads it, and an ambiguous default path would break that promise.ship that would otherwise have applied between those two tables. When the calculation ends, nothing in the model has changed. The next measure on the page goes back to the active relationship. USERELATIONSHIP is scoped to a single evaluation, and that scoping is exactly what makes it safe.
Two further points separate a complete answer from a merely correct one. The first is slicers. A single Date slicer now drives both visuals, which is usually what the stakeholder wants — select March, and the order visual shows orders placed in March while the ship visual shows orders shipped in March. Those are different sets of orders, and the page must say so in its titles: “Sales by order date” and “Sales by ship date,” not “Sales” twice. If the stakeholder instead wants to slice orders and shipments independently, that is the moment to discuss a second, separate date table for the ship role, accepting the extra model weight in exchange for independent slicing. Naming that trade-off unprompted marks someone who has shipped this pattern rather than only studied it.NK ( PriorRank ),
PriorRank - CurrentRank
)
```
A product ranked 7 last year and 3 this year has a change of positive 4 — it climbed four places. Defining change as prior minus current makes improvement positive, a choice worth stating because half the room builds it the other way and describes a climber as negative. The deeper point is why CALCULATE sits inside the RANKX expression: every product in the set must be evaluated on last year’s sales, so the shift applies during the iteration, product by product. Shifting only the current row’s value would compare this year’s league table against a single moved number.
### The follow-up the interviewer asks next
“You ranked ten thousand customers and the visual takes forty seconds. What do you do?” Start with diagnosis: RANKX evaluates the expression ten thousand times for each of ten thousand rows, so cost grows with the square of the set. Then ask whether the report needs every rank or only the leaders. If only the leaders, TOPN cuts the work dramatically. If every rank is needed, rank over a compact key table, simplify the expression, reduce the visual’s density, or pre-aggregate.
RANKX (
ALL ( Product[ProductName] ),
[Sales Amount],
,
DESC,
DENSE
)
```
The empty third argument is the value placeholder: leaving it blank lets RANKX use the expression evaluated in the current context, the normal case. Stating DESC even though it is the default shows the order is a choice — ASC would rank the smallest sale first, for a worst-performers list.ATETABLE must sit inside the second variable’s definition, because wrapping Returning in a later CALCULATE would not rebuild the table — and the RETURN counts the intersection. Extending variables from numbers to tables without changing the mental model shows the feature was understood, not memorised.
### The follow-up the interviewer asks next
“If variables are evaluated once, why does the same measure give a different answer on every row?” Because the measure as a whole is evaluated once per filter context, so on each row the variables are freshly defined inside that row’s context. Evaluated once means once per evaluation, not once for the whole visual. Per context, immutable within it, refreshed across contexts — candidates who can state that close the question completely. CALCULATE ( [Sales Amount], ALL ( Product ) )
RETURN
DIVIDE ( CurrentSales, AllProductSales )
```
CurrentSales is evaluated in the visual’s context — say, one product category. AllProductSales is evaluated inside a CALCULATE that removes the Product filter, so it holds sales across all categories; the ratio is the category’s share. If you reference CurrentSales inside a later CALCULATE and expect it to change, it will not: once defined, it is a fixed number, and a CALCULATE wrapped around a variable reference has nothing to re-evaluate — there is no expression left, only a value. So comparing two contexts means one variable per context, each with its own CALCULATE at definition time.
Third, a variable is immutable and scoped: it cannot be assigned twice, and it exists only inside its measure.he previous fiscal period. Where the structure is more exotic — 4-4-5 retail calendars — the honest answer changes: time-intelligence functions assume a standard calendar, so build the comparison with explicit Fiscal Year and Fiscal Period filters instead, and say so.
### The follow-up the interviewer asks next
“Your year-to-date card is filtered to the full year. What is it actually summing?” In a full-year context, year-to-date runs to the last date in that context, which may be 31 December, including future months if the fact contains them. In production you usually cap it at the last date with actual sales — the maximum sale date in the fact, not the maximum date in the calendar. Candidates who can make that distinction have moved from writing measures to designing them.
CALCULATE (
[Sales Amount],
DATESYTD ( ‘Date’[Date] )
)
```
The two are equivalent for a calendar year, and DATESYTD is the more flexible form because its family includes DATESMTD and DATESQTD. The sentence that matters is this: the function does not sum anything by itself; it supplies dates to CALCULATE, and CALCULATE evaluates in that modified filter context.dates who framed the original as “remove exactly the grain you are sharing across” solve the variant in one edit; candidates who memorised a block of code start over.
### The Follow-Up the Interviewer Asks Next
“Your percent is right in the matrix, but the client filters to a single category with a slicer and now it shows 100 percent. Is that a bug?” It is the best closing question in this set, because the honest answer is: it depends on what the business means by total. If the slicer’s category is part of the context the denominator should respect, 100 percent is correct — the selected category is all of the selected world. If the share should still be measured against all categories regardless of the slicer, the denominator must also overcome that slicer filter, which the row-level removal already does only if the slicer and the row act on the same column — a nuance worth walking through slowly, distinguishing visual row filters from external slicer filters and confirming the intended scope with the stakeholder rather than silently picking one. Interviewers reward that answer because it ends the technical chain in the right place: the DAX is settled, and what remains is a definition, owned by the business, that the measure must be told about explicitly.
```
Read it carefully: ALLEXCEPT preserves the Category filter — Bikes stays Bikes — while clearing other Product filters such as Subcategory or Product Name that the visual may have applied, so the denominator becomes all Bikes sales under the remaining outer context. If Bikes totals $18,000,000 in the selected scope and a drilled subcategory row shows $4,500,000, its share within category is 25.00 percent. The general lesson matters more than this single pattern: choose REMOVEFILTERS when the list of things to drop is short and known; choose ALLEXCEPT when the list of things to keep is short and known. Naming which list is shorter, for the scope in front of you, is the judgement the interviewer is pricing.
Finally, DIVIDE is not decoration. DIVIDE ( numerator, denominator ) returns blank when the denominator is zero or blank, and accepts an optional alternate result. Writing numerator divided by denominator with the slash operator surfaces an infinity or error in exactly the sparse, heavily filtered visuals where percent measures are most often added late in a project. Stating that unprompted is a small, credible signal of production experience.“If SUMX is iterating rows, what is the row context — and what happens to it when the expression inside SUMX references another measure?” The interviewer is circling back to context transition deliberately, checking that the two answers cohere. The expected reply is concise: SUMX creates a row context for the current row of its table argument; a measure reference inside that row context triggers context transition, converting the row into filters; a plain column reference does not, it merely reads the value from the current row. If you can say that, and connect it to the Products Over 100K measure above, the iterator line of questioning usually closes in your favour — and the interview moves on to shares and totals, where filters are removed rather than added.situations: context transition inside an iteration over a very large number of distinct values, where a complex measure is paid for thousands of times; nested iteration, which multiplies row visits; and iterating a large unfiltered fact table when a smaller table — VALUES of a dimension key, as above — would answer the same question far more cheaply. The senior answer is not “avoid SUMX.” It is: prefer SUM when the column already holds the answer; use SUMX when the value must be computed per row; keep the per-row expression simple; iterate the smallest table that carries the grain you need; and measure with Performance Analyzer or DAX Studio before optimising on instinct. Materialising a calculated column purely to avoid an iterator trades query-time cost for refresh-time and model-size cost — sometimes the right trade, never a free one.
One more distinction completes the answer: SUMX ignores rows where the expression returns blank, and its table argument is evaluated in the outer filter context, so a visual filtered to 2025 iterates only the 2025 rows. Filters in, rows visited, expression evaluated, results summed — that is the complete mental model.s what appears in every row, and the matrix total is also $28,450,000. That repetition is not an error to be fixed with formatting. It is the clearest possible demonstration that CALCULATE replaces, rather than intersects, when both filters target the same column.wrong but by describing everything at once, in no order, so that cause and effect blur. Walk the engine’s path step by step and the variant answers itself.
**The follow-up.** Expect: “If row context doesn’t filter anything, how can a calculated column on the Product table ever show me that product’s total sales?” The answer the interviewer wants has two honest routes. Either the column reaches across the relationship deliberately, using RELATEDTABLE to bring the product’s Sales rows into scope and summing them inside an iterator — or it references a measure, in which case context transition converts the product row into a filter and the measure does the work. A candidate who can offer both routes, and say that the second is usually cleaner, has turned a follow-up designed to catch people out into the strongest moment of the answer.

