Resolving a Fan Trap

Objectives

After completing this lesson, you will be able to:

  • Resolve a Fan Trap

Fan Trap Resolution

The possible ways to solve a fan trap problem are:

  • Use a combination of aliases and contexts

  • Avoid the fan trap scenario

Aliases and Contexts

Create an alias for the first table on the many end of the join. Use the Detect Contexts tool to detect and propose a context for the alias table and a context for the original table. Define the SELECT statement for any objects from the aliased table to refer to the aliased table.

Fan Trap Avoidance

You can avoid the scenario in the first place by relating all measure objects in the universe to the same table in the universe structure. Avoid placing a measure on anything other than the most detailed table in a table path, which is usually the last table with the many cardinality attached to it.

In the Motors universe, the Sales Revenue measure is not based on the SALES_TOTAL figure in the SALE table, but on a number of columns from the SALE, SALE_MODEL, and MODEL tables, which are held in the database at the same level of granularity as the number of cars sold. Therefore, no fan trap exists and the correct result is obtained.​

Explore and Resolve a Fan Trap

Fan traps can be tricky to locate, and the solution is a little more complicated than resolving a chasm trap. But this short video can help take the mystery out of it.

Explore and Resolve a Fan Trap in the IDT

Due to the database structure, a query at the Client and Sales Order level can result in a fan trap. Make sure to avoid the trap by using aliases and contexts.

Log in to track your progress & complete quizzes