Using the RELATED function
The RELATED
function leverages the relationships built in the model Diagram view. In this model, there is a one to many relationship between the LIGHT_T table and the CRASH_DATA_T table. The RELATED
function is applied on the many table (CRASH_DATA_T) and performs a lookup on the one table (LIGHT_T).
This recipe uses the RELATED
function to create a new calculated column. This column will add the label from the LIGHT_T table to the CRASH_DATA_T table. This can be helpful when you have a frequently used column and your users do not need to select from the associated table each time they access the data. The RELATED
function has a required syntax of RELATED(<column>)
.
How to do it...
Open the Chapter_9_DAX solution and select the CRASH_DATA_T table and make sure you are in the data Grid view.
Scroll to the right until you find the Add Column. Then in the expression box, add the formula to return the label from the LIGHT_T table. You will then see the corresponding...