In this article I am going to explain the different delete actions available for tables in DAX 2012.

None

With the Value None, the delete action is disabled.

Cascade

Assuming we have TableA and TableB, where TableB is related to TableA.

When a record is deleted from TableA, the records on TableB that are related to the deleted records on TableA, are also deleted.

The delete action is defined in the DeleteActions node of TableA, indicating the related table, the desired delete action and the name of the Relation that relates the data between the tables.

1

 

 

Example:

a)      We have a record on TableA and a record on TableB which is related to the record on TableA.

 

2

 

a)      We delete the record on TableA.

3

 

After we refresh the Table browser, the record on TableB that was related to the record on TableA was also deleted.

 

4

 

Restricted

Assuming we have TableA and TableB, where TableB is related to TableA.

When a record is deleted from TableA, if there are records on TableB that are related to the record that was intended to delete from TableA, the deletion will be restricted.

5

 

 

Example:

We have a record on TableA and a record on TableB which is related to the record on TableA.

6

 

When we try to delete the record from TableA, the deletion is restricted because there is a record on TableB, that us related to the record that we intended to delete form TableA.

7

 

Cascade + Restricted

Assuming we have TableA, TableB and TableC, where TableC is related to TableB and TableB  is related to TableA, and there is a delete action on TableA to delete Records from TableB as Cascade.

If we setup de delete action on TableB as Cascade + Restricted (Delete action for TableC), the behavior of the deletion of record from TableC through the delete actions will be the following:

  • If we delete directly a record from TableB, it will behave as Restricted.
  • If a record from TableB is deleted through a Delete action setup in another table, the behavior will be as Cascade.

Example 1:

a)      We have a record on TableC and related to the record on TableB and that from TableB is related to the record on TableA.8

We try to delete the record from TableB, and the deletion is restricted

9

 

Example 2:

Since we did not delete anything we are going to do it with the same records.

a)      We delete the record from TableA.

10

 

Records from TableB and TableC were also deleted.

11