Short answer: TREATAS ( table, column1 [, column2, ...] ) takes the rows of a table and applies them as a filter on the columns you name, as if the values came from those columns. Inside CALCULATE it creates a virtual relationship: filter a Budget table by the months and categories selected on the Date and Product tables, even though there is no relationship. The number of columns must match, and values that do not exist in the target column are ignored.
Budgets, targets and forecasts usually sit at a coarser grain (month and category) than sales (day and product). A many-to-many relationship would work, but TREATAS keeps the model simple and the logic in the measure.
How does it work?
- 1Visual filterYear 2026, Category Bikes
- 2VALUESthe visible months and categories from Date and Product
- 3TREATAStreats them as Budget[Month] and Budget[Category]
- 4Budgetfiltered to the same months and category
Budget =
CALCULATE (
SUM ( Budget[Amount] ),
TREATAS ( VALUES ( 'Date'[Year Month] ), Budget[Year Month] ),
TREATAS ( VALUES ( 'Product'[Category] ), Budget[Category] )
)
Revenue vs Budget % = DIVIDE ( [Revenue] - [Budget], [Budget] )At day or product level the budget shows the month or category value. Hide it below its grain with IF ( NOT ISINSCOPE ( 'Product'[Product] ), [Budget] ).
How do you filter several columns at once?
TREATAS with a multi-column table filters on combinations, not on each column separately:
Revenue of Budgeted Combinations =
CALCULATE (
[Revenue],
TREATAS (
SUMMARIZE ( Budget, Budget[Year Month], Budget[Category] ),
'Date'[Year Month],
'Product'[Category]
)
)Only month and category pairs that exist in Budget filter the sales.
How do you use a fixed list or a disconnected slicer?
-- a fixed list
Main Markets Revenue =
CALCULATE ( [Revenue], TREATAS ( { "DE", "AT", "CH" }, Customer[Country] ) )
-- a slicer on a disconnected table 'Compare Region'
Compare Region Revenue =
CALCULATE (
[Revenue],
TREATAS ( VALUES ( 'Compare Region'[Region] ), Region[Region] )
)The second lets readers pick a comparison region in its own slicer without filtering the rest of the page.
Why not FILTER with IN?
-- works, but slower on large columns
Budget Old =
CALCULATE (
SUM ( Budget[Amount] ),
FILTER ( ALL ( Budget[Category] ), Budget[Category] IN VALUES ( 'Product'[Category] ) )
)TREATAS passes the values directly as a filter, which the engine handles efficiently; FILTER ... IN iterates the column and tests each value.
When is a relationship better?
| Situation | Choice |
|---|---|
| one budget per month and category, used in many measures | a relationship from a Month or Category bridge table, or TREATAS in one Budget measure |
| several relationships between the same tables | USERELATIONSHIP (Microsoft's advice in the TREATAS reference) |
| an ad hoc filter from a disconnected slicer | TREATAS |
| the grain matches and keys are unique | a normal one-to-many relationship |
What goes wrong?
- Wrong column count. The table and the column list must have the same number of columns, in the same order.
- Type mismatch. A text month "2026-10" does not match a date; values that do not exist are silently ignored, so the result is blank.
- Showing the budget below its grain. Daily budget values look like the monthly total on each day; hide them.
- DirectQuery. Not supported in calculated columns or RLS rules in DirectQuery mode.
Where can you check this?
- Microsoft Learn: TREATAS function (DAX)
- Microsoft Learn: Many-to-many relationship guidance
- Microsoft Learn: ISINSCOPE function (DAX)
Where do you start?
Load your budget at month and category grain and write the Budget measure above. Budget variance turns it into a KPI.