DAX Function Guide

EXCEPT
Empty image or helper icon

Sam McKay

CEO & Founder

How does the EXCEPT work?
The EXCEPT function (DAX) returns the rows of one table which do not appear in another table.
EXCEPT Formula Syntax

EXCEPT (
     <table_expression1> <table_expression2>
)

How do you use the EXCEPT?

The EXCEPT function is used to exclude like rows that are found in one query but not another.  It returns rows that are unique to one result.  To use the EXCEPT operator, both queries must return the same number of columns and those columns must be of compatible data types.

Related Blog Posts

Loading

Considerations when using the EXCEPT?

If a row appears at all in both tables, it and its duplicates are not present in the result set. If a row appears in only table_expression1, it and its duplicates will appear in the result set.

The column names will match the column names in table_expression1.

The returned table has lineage based on the columns in table_expression1 , regardless of the lineage of the columns in the second table. For example, if the first column of first table_expression has lineage to the base column C1 in the model, the Except will reduce the rows based on the availability of values in the first column of second table_expression and keep the lineage on base column C1 intact.

The two tables must have the same number of columns.

Columns are compared based on positioning, and data comparison with no type coercion.

The set of rows returned depends on the order of the two expressions.

The returned table does not include columns from tables related to table_expression1.

Related Video Tutorials

Loading

Formula examples using the EXCEPT

= SUMX (EXCEPT (SalesNewData,SalesOldData),[Sales Amount])

Aggregate( Except( [Customers].[USA].Members, { [Customers].[USA].[CA], [Customers].[USA].[OR], [Customers].[USA].[WA] } ) )

=EXCEPT(Last_month;This_month)

Related Courses

Loading