Knowledge Base
Open App
KB 101800

Function usage RELATEDTABLE


Checks whether the RELATEDTABLE function is not needed as there is no active row context.

Remarks

If the RELATEDTABLE function is invoked without an active row context, it does not perform any action. Even though it does not impact performance because there is no context transition involved, it is better to remove the function to make the code easier to read, or re-evaluate the code structure in case the context transition was needed.

Example

Remove RELATEDTABLE as it is redundant and it does not produce any effect.

Original code

Canada Sales :=
CALCULATE (
    [Sales Amount],
    FILTER ( 
        RELATEDTABLE (
            Customer
        ),
        Customer[Country] = "Canada"
    )
)

Possible optimization

Canada Sales :=
CALCULATE (
    [Sales Amount],
    FILTER ( 
        Customer,
        Customer[Country] = "Canada"
    )
)