ALLEXCEPT
Removes every filter on a table except those on the columns named.
Group: Filter. Compatible with DAX.
Syntax
ALLEXCEPT ( <table>, <column> [, <column>] … )
| Parameter | Type | Description |
|---|---|---|
table | Table | A table of the model whose filters are removed. |
column | Column repeatable | A column whose filter stays: of the table, or of a table it reaches. |
Returns
Table. As a filter of CALCULATE, the table's filters taken away except those on the columns listed.
Remarks
ALLEXCEPT ( Products, Products[Category] )lets a product be compared with its whole category: the filter on the product goes, the one on the category stays.- The filters of the tables the first one reaches go as well:
ALLEXCEPT ( Sales, Sales[Shop] )also removes a filter on Places[Kind], although it is a column of Places. - A listed column may belong to such a table:
ALLEXCEPT ( Sales, Products[Category] )keeps only the category's filter. - It keeps a filter only where there is one; it never adds one.
- The first argument must be a table of the model, not a table expression.
Examples
Each product's share of its category
EVALUATE
SUMMARIZECOLUMNS (
Products[Category],
Products[Product],
"Liters", [Liters sold],
"Share of category", DIVIDE ( [Liters sold], CALCULATE ( [Liters sold], ALLEXCEPT ( Products, Products[Category] ) ) )
)
ORDER BY Products[Category], Products[Product]
| Products[Category] | Products[Product] | Liters | Share of category |
|---|---|---|---|
| Beer | IPA | 331884 | 0.220463946528107 |
| Beer | Lettøl | 169179 | 0.112382248043529 |
| Beer | Pils | 1004326 | 0.667153805428364 |
| Cider | Cider | 301074 | 1 |
A filter on a related table goes too
The rows group by Places[Kind]. Sales reaches Places, so that filter is removed with the others, and both rows show every liter; the depot's row appears only because of it.
EVALUATE
SUMMARIZECOLUMNS (
Places[Kind],
"Liters", [Liters sold],
"ALLEXCEPT ( Sales, Sales[Shop] )", CALCULATE ( [Liters sold], ALLEXCEPT ( Sales, Sales[Shop] ) )
)
ORDER BY Places[Kind]
| Places[Kind] | Liters | ALLEXCEPT ( Sales, Sales[Shop] ) |
|---|---|---|
| Depot | (blank) | 1806463 |
| Shop | 1806463 | 1806463 |