DAX TREATAS for Disconnected Slicers in Lakehouse Semantic Models
Apply DAX TREATAS to disconnected slicers in lakehouse semantic models. Check filter propagation, matching keys, blank values, RLS and expected results.
TREATAS applies a table expression's values as a filter on columns from an unrelated table, so a disconnected slicer can drive a measure without any physical relationship. It is filter injection at evaluation time, not a relationship: no cardinality guarantee, no cross-filter direction, no model-level integrity enforcement. This tutorial builds a reproducible lakehouse-backed semantic model, shows runnable DAX with expected outputs, and covers multi-column matching pitfalls and performance trade-offs. General DAX performance guides optimize what the engine evaluates; this article addresses how a filter reaches a fact table at all when no relationship exists.
Author: jackey.ye · Last updated: 2026-11-24
What TREATAS Does and What It Does Not Do
Microsoft defines TREATAS as applying "the result of a table expression as filters to columns from an unrelated table," returning a table of the rows in the target column(s) that also appear in the table expression. The signature is TREATAS(tableExpression, <column>[, <column>[,…]]), and the column arguments must be existing columns, not expressions.
A slicer bound to a standalone table has no relationship, so its selection does not propagate. Microsoft's model relationships guidance describes such a table as disconnected: it "isn't intended to propagate filters to other model tables. Instead, it accepts 'user input' (perhaps with a slicer visual), allowing model calculations to use the input value in a meaningful way." TREATAS is the mechanism that turns that input into a filter on the column your measure actually aggregates over.
The caveat is scoped and important. TREATAS creates a filter at evaluation time only. It does not create a model relationship, so it does not enforce referential integrity, does not participate in cross-filter direction, does not appear in the relationship diagram, and does not affect other measures or visuals. The same page calls it a way "to create a virtual relationship during the evaluation of a specific calculation" — virtual, and specific to that calculation.
Two documented behaviours shape how you use it. First, "if a value returned in the table expression does not exist in the column, it is ignored" — the function's own example filters DimProduct[Color] with Red, Green and Yellow, and if Yellow is absent the effective filter is Red and Green. Second, TREATAS is "best for use when a relationship does not exist between the tables"; if multiple relationships already exist between the tables involved, Microsoft points to USERELATIONSHIP instead.
TREATAS Versus a Physical Relationship
The table below turns the documented semantics into a decision aid. Read down the column that matches your constraint — governance, reuse, direction control, or an ad hoc parameter — rather than treating either row as universally better.
Dimension | Physical relationship | TREATAS virtual filter |
|---|---|---|
What is created | A persisted model relationship between one column in a table and one column in a different table | A filter applied during evaluation of one |
Where it lives | Model metadata; visible in Model view and the relationship diagram | Inside the measure definition; invisible in the diagram |
Filter propagation | Propagates automatically to related tables, directly or indirectly | Applies only to the target columns named in the call, only in that calculation |
Referential integrity | Behaves as an inner join; if integrity is compromised, "the inner join eliminates unmatched rows," understating results | Values in the table expression with no match in the target column are silently ignored |
Effect on other measures and visuals | Model-wide; every measure and visual that crosses the relationship is affected | Scoped to the measure that contains it; other measures are unaffected |
Cross-filter direction | Configurable: one-to-many is single-direction from the "one" side, optionally bi-directional; many-to-many can filter from either or both | Not applicable; there is no direction to configure |
Multi-column support | One column to one column, with a specialized multi-column case for DirectQuery models via | Multiple target columns supported, provided count and order match the table expression |
Storage-mode constraints | Data types of the "from" and "to" columns should match; | Documented as not supported in DirectQuery mode when used in calculated columns or RLS rules |
Typical use case | Conformed dimensions, star-schema filter paths, reusable model-wide slicing | Scenario, what-if, currency or comparison selectors; many-to-many without a clean key; filters that must touch only some measures |
The trade-off is structural. Governance and reuse favour a relationship: it is declared once, documented in the diagram, and enforced consistently. Ad hoc, parameter-like, or key-less many-to-many scenarios favour TREATAS, at the cost of repeating the filter logic in every measure that needs it.
Prerequisites and Model Setup
You need Power BI Desktop with a semantic model whose storage mode you know: Import, DirectQuery, or Direct Lake on a Fabric lakehouse. TREATAS is documented as not supported in DirectQuery mode when used in calculated columns or row-level security rules, so every example here is a plain measure. If you are still choosing a connection mode, this comparison of Power BI semantic model connections in Power BI Desktop covers the trade-offs.
The reference model is deliberately small:
Sales— fact table withAmount,ProductKey,Category,Region,Year,OrderDate.CategorySelector— disconnected table with a singleCategorycolumn, loaded but unrelated.RegionYearSelector— disconnected table withRegionandYearcolumns, used for the multi-column section.
Create the selectors as calculated tables so the setup is reproducible without an external source:
CategorySelector =
DATATABLE (
"Category", STRING,
{
{ "Bikes" },
{ "Clothing" },
{ "Accessories" }
}
)
RegionYearSelector =
DATATABLE (
"Region", STRING,
"Year", INTEGER,
{
{ "North", 2025 },
{ "South", 2025 },
{ "North", 2026 },
{ "South", 2026 }
}
)
Checkpoint: in Model view, confirm that no relationship line connects either selector table to any other table. If one exists, delete it — a relationship would change the behaviour the tutorial is designed to demonstrate.
Step-by-Step Implementation
Each step gives the DAX, the expected output, and a checkpoint. Expected outputs are described behaviourally, not as measured figures.
Build the disconnected selector. Create
CategorySelectorwith theDATATABLEdefinition above and add a slicer bound toCategorySelector[Category]. Checkpoint: the slicer renders three values and no relationship line exists in Model view.Write the baseline measure and confirm the slicer does nothing.
Total Sales = SUM ( Sales[Amount] )
Expected output: a card or table visual shows the same total for every slicer selection, including no selection. This is the failure the tutorial fixes — the slicer's filter context never reaches Sales.
Inject the slicer selection with TREATAS. CALCULATE modifies the filter context; VALUES returns the distinct visible values of the slicer column, so the measure follows the selection.
Selected Category Sales =
CALCULATE (
SUM ( Sales[Amount] ),
TREATAS (
VALUES ( CategorySelector[Category] ),
Sales[Category]
)
)
Expected output: selecting Bikes returns the Bikes subtotal; selecting Bikes and Clothing returns their sum; clearing the slicer returns the full total, because VALUES then returns all three selector rows. Checkpoint: the total changes with the slicer and the unfiltered total is unchanged.
Add a selected-versus-total ratio.
REMOVEFILTERSon the selector removes its filter from the denominator only.
Selected vs Total =
DIVIDE (
[Selected Category Sales],
CALCULATE ( [Total Sales], REMOVEFILTERS ( CategorySelector ) )
)
Expected output: with one category selected, the ratio is that category's share of the grand total; with all categories selected, it returns 1 (100%). DIVIDE returns BLANK rather than an error when the denominator is zero or blank.
Validate against a physical-relationship equivalent. On a copy of the model, relate
CategorySelector[Category]toSales[Category](many-to-one) and replace the measure withCALCULATE ( SUM ( Sales[Amount] ) ). Expected output: identical subtotals for every selection where the selector values all exist inSales[Category]. Any divergence points to unmatched selector values, which TREATAS ignores and the relationship's inner join also drops — but for different reasons, so check the row counts.
Multi-Column Matching Pitfalls
The documented rule is compact: "the number of columns specified must match the number of columns in the table expression and be in the same order." Most production failures come from violating it in ways that either error loudly or, worse, match the wrong rows quietly.
Count and order. TREATAS(t, A[x], B[y]) is not the same as TREATAS(t, B[y], A[x]). If t has columns Region then Year, the first form matches Region-to-Region and Year-to-Year; the second matches Region values against B[y] and Year values against A[x], producing no rows or nonsense rows depending on the data. A count mismatch raises an error; an order mismatch may not.
Data types. Target columns and table-expression columns must be compatible. A text key matched to a numeric key will not match, and the silent-ignore rule then makes the measure return BLANK rather than an error — the hardest failure to spot in a visual.
Lineage and filter context. VALUES on a filtered column returns only the visible values. That is usually what you want for a slicer, but it is a trap when the measure is reused under other filters on the selector table: the injected filter shrinks with them. Use ALL on the selector column when you need the full list regardless of context.
Direction. TREATAS filters the target columns; it does not filter the selector table. A measure that also aggregates the selector table behaves differently from one that only aggregates the fact table.
Worked two-column example. With RegionYearSelector above:
Selected Region-Year Sales =
CALCULATE (
SUM ( Sales[Amount] ),
TREATAS (
SUMMARIZE ( RegionYearSelector, RegionYearSelector[Region], RegionYearSelector[Year] ),
Sales[Region],
Sales[Year]
)
)
Correct order: selecting North/2025 returns North sales for 2025 only. Swapped order — Sales[Year], Sales[Region] — matches year values against Region and region values against Year; expect BLANK or wrong rows. Expected difference: the correct form reconciles with a Sales filtered to the same Region and Year; the swapped form does not.
Totals reconciliation. Because unmatched selector values are ignored, a selector row with no matching fact rows contributes zero silently. Reconcile totals by comparing COUNTROWS of the matched set against the selector's row count before trusting a subtotal.
Performance Limitations as Modelling Trade-offs
TREATAS is evaluated as part of the filter context of the CALCULATE that contains it. Its cost therefore scales with the cardinality of the table expression and of the target column, and it is re-evaluated on every visual query that uses the measure. A physical relationship, by contrast, is model metadata whose filter propagation the engine can optimize across the model. That is a directional statement, not a benchmark: measure it in your own model.
Storage mode changes the cost profile. In Direct Lake, queries are processed by the VertiPaq engine, and Microsoft states that Direct Lake and Import queries "normally outperform DirectQuery queries when loading and interacting with visuals in reports." But a table that falls back to DirectQuery — for example, one based on a non-materialized SQL view in Direct Lake on the SQL analytics endpoint — moves the work to the source. Microsoft's DirectQuery model guidance warns that while CALCULATE "can be used to produce sophisticated measure expressions that manipulate filter context, they can generate expensive native queries that don't perform well."
Verify rather than assume. Copy the visual's DAX query into DAX Studio with Server Timings enabled and compare formula-engine and storage-engine time with and without the TREATAS filter, on the same result set. If the storage-engine share rises sharply, the injected filter is pushing work down; if formula-engine time dominates, the table expression itself is the cost.
This is where the article differs from general DAX performance guides. Those address expression-level optimization — variables, iterator removal, predicate rewrite. This section addresses a model-level decision: whether a virtual filter belongs in the measure at all, and when to promote it to a relationship. For the expression-level layer, see the companion guide on DAX performance optimization for lakehouse models, which covers attribution between the formula engine, the storage engine and the lakehouse underneath; the two are complementary, not competing.
When to Choose TREATAS and When to Build a Relationship
Choose TREATAS when the selector is genuinely parameter-like — a scenario switch, a what-if assumption, a currency or comparison target — because those inputs have no natural key in the fact table. Choose it when the match is many-to-many without a clean key, when the filter must apply to only some measures, or when the model must stay unchanged for governance reasons and adding a relationship would require a change-control cycle.
Choose a physical relationship when the filter should apply model-wide, when referential integrity is enforced at the source, when bi-directional cross-filtering is needed, or when the same filter will be reused across many measures and reports. The relationship is declared once and documented in the diagram; TREATAS must be repeated in every measure that needs it, which is a maintenance cost as well as a correctness risk.
A hybrid is common and worth naming: keep a physical relationship for the primary path, add USERELATIONSHIP for role-playing dimensions, and reserve TREATAS for the parameter cases. That keeps the model diagram honest about which filters are structural and which are ad hoc.
Validation Checklist
Run these before shipping a TREATAS measure. Each item ties to the step or pitfall it verifies.
Slicer selection changes the TREATAS measure and only the intended measure (Step 3; scoping caveat in the first section).
Totals reconcile with the physical-relationship equivalent on the same result set (Step 5).
Multi-column matches tested with a known-mismatch row and with the argument order deliberately swapped (Multi-Column Matching Pitfalls).
Unmatched selector values confirmed ignored rather than erroring, and the resulting zero contribution documented (documented silent-ignore behaviour).
No TREATAS usage inside calculated columns or RLS rules on a DirectQuery model (documented limitation).
Server Timings compared with and without the injected filter on the same result set (Performance Limitations).
Model diagram confirms no accidental relationship was added to the selector table (Prerequisites checkpoint).
Frequently Asked Questions
Does TREATAS create a relationship?
No. TREATAS applies a table expression as a filter on columns from an unrelated table during the evaluation of a single calculation. It does not appear in the relationship diagram, does not enforce referential integrity, and does not affect other measures or visuals. Microsoft describes it as creating a virtual relationship for that calculation only.
Why does my slicer still not filter after adding TREATAS?
The most common causes are a target column that does not match the selector values, a data-type mismatch between the table expression and the target column, or TREATAS placed outside the CALCULATE that defines the measure. Unmatched values are ignored; when none of the selected values match, the result can be BLANK or zero depending on the measure. Check that the target column holds the same values and type as the selector, and that the call sits inside CALCULATE.
Can TREATAS match on more than one column, and what breaks?
Yes, TREATAS accepts multiple target columns, but the number of columns must match the table expression and be in the same order. A count mismatch raises an error; an order mismatch can silently match the wrong columns and return wrong or empty results. Align data types explicitly and test nonmatching values; do not rely on implicit conversion or a particular failure mode.
Does TREATAS work in DirectQuery or with row-level security?
TREATAS is documented as not supported in DirectQuery mode when used in calculated columns or row-level security rules. In a plain measure it is supported, but the injected filter can generate expensive native queries on a DirectQuery source. Validate the generated query and its timing before relying on it in a DirectQuery model.
Is TREATAS slower than a physical relationship, and how do I tell?
It can be, because the filter is evaluated per visual query and its cost scales with the cardinality of the table expression and target column, whereas a relationship's propagation can be optimized across the model. To tell, run the visual's DAX query in DAX Studio with Server Timings and compare formula-engine and storage-engine time with and without the TREATAS filter on the same result set.
Continue with the date-role relationship validation to validate the related implementation.