Using the RELATEDTABLE function
The RELATEDTABLE
function changes the context in which the data is filtered, and evaluates the expression in the new context that you specify.
This function is a shortcut for the CALCULATETABLE
function with no logical expression.
The RELATEDTABLE
function leverages the relationships built in the model Diagram view. In this model, there is a one to many relationship between the Manner_of_Crash table and the CRASH_DATA_T table. The RELATEDTABLE
function is applied on the many table (Manner_of_Crash) and performs a lookup on the one table (CRASH_DATA_T).
In this recipe, you will create a new column to the Manner_of_Crash table. This recipe uses the RELATEDTABLE
function to count the number of rows in the CRASH_DATA_T table that occur by the Manner_of_Crash. This will provide a summary by row. The REALTEDTABLE
function has a required syntax of RELATEDTABLE(<tableName>)
.
How to do it...
Open the Chapter_9_DAX solution, select the Manner_of_Crash table, and make...