Skip to main content

Minimizing ANY joins

Reducing the number of ANY joins for a model reduces the risk of calculations running longer than expected.

Recommendations for minimizing ANY joins

ANY joins can be removed by separating calculations and then using a UNION to combine the results.

Transforming ANY to AND

Another approach to minimize ANY joins is to modify the data source and convert the ANY constraints into a single AND constraint.

For example:

  • Consider logic that uses OR conditions to filter transactions based on a TERRITORY attribute, such as {ON, AB, BC}.

  • To simplify, create a new Boolean attribute called OR_TERRITORIES, setting it to TRUE for transactions in {ON, AB, BC}.

  • The calculation can then constrain on OR_TERRITORIES = TRUE instead of using the multiple OR conditions:

    TERRITORY = 'ON' OR TERRITORY = 'AB' OR TERRITORY = 'BC'.

Limitations

Some scenarios may not allow this approach due to data source limitations or when the ANY logic involves multiple data sources that can’t be easily modified.