Example: Calculation with Lookup (Relative)

This scenario shows how the “Relative” calculation type obtains values from another model table using lookup and how it calculates the amount based on the selection condition and formula used.

Input

This is the table that will be used as an input function:

Input 1: CA - Data Table 1
Channel Account Customer Product Quantity Amount
90AH5 1 CN007 PROD01 80 17.9
90AH4 3 CN008 PROD02 100 14.6
90AH2 2 CN002 PROD01 40 23
90AH5 1 CN002 PROD02 25 30
90AH1 1 CN001 PROD01 20 20
90AH3 3 CN003 PROD03 30 25
90AH3 3 CN005 PROD01 20 24.5
90AH4 1 CN001 PROD02 33 40
90AH2 1 CN004 PROD01 25 28
90AH4 3 CN006 PROD01 40 21.2
90AH1 2 CN004 PROD03 30 33
90AH5 1 CN009 PROD02 75 11.3

This is the table that will be used as the lookup input:

Input 2: CA - Data Table 2
Channel Account Customer Product Quantity Amount
90AH3 3 CN003 PROD03 15 62.5
90AH4 1 CN001 PROD02 89 250
90AH1 2 CN004 PROD03 99 206.25
90AH4 3 CN006 PROD01 112 132.5
90AH5 3 CN010 PROD03 55 20
90AH1 1 CN001 PROD01 76 125
90AH2 2 CN002 PROD01 80 143.75
90AH1 1 CN004 PROD01 103 175
90AH2 1 CN009 PROD02 126 70.63
90AH4 1 CN001 PROD02 17 100
90AH5 1 CN002 PROD02 13 75
90AH5 1 CN007 PROD01 40 44.75
90AH5 2 CN002 PROD01 20 57.5
90AH3 3 CN005 PROD01 108 153.13
90AH5 1 CN007 PROD01 117 111.88
90AH1 2 CN004 PROD03 15 82.5
90AH3 3 CN005 PROD01 10 61.25
90AH5 1 CN009 PROD02 75 28.25
90AH2 1 CN004 PROD01 13 70
90AH5 1 CN002 PROD02 94 187.5
90AH5 3 CN010 PROD03 130 50
90AH1 1 CN001 PROD01 10 50
90AH4 3 CN006 PROD01 20 53
90AH4 3 CN008 PROD02 50 36.5
90AH3 3 CN003 PROD03 85 156.25
90AH4 3 CN008 PROD02 121 91.25

Calculation

  1. Collect all entries containing “90AH5” on the Channel field of Data Table 1.

    CA - Data Table 1
    Channel Account Customer Product Quantity Amount
    90AH5 1 CN007 PROD01 80 17.9
    90AH5 1 CN002 PROD02 25 30
    90AH5 1 CN009 PROD02 75 11.3
  2. Collect all entries containing “90AH5” on the Channel field of Data Table 2 and sum up the “Amount” field.

    CA - Data Table 2
    Channel Account Customer Product Quantity Amount
    90AH5 3 CN010 PROD03 55 20
    90AH5 1 CN009 PROD02 126 70.63
    90AH5 1 CN002 PROD02 13 75
    90AH5 1 CN007 PROD01 40 44.75
    90AH5 1 CN007 PROD01 117 111.88
    90AH5 1 CN009 PROD02 75 28.25
    90AH5 1 CN002 PROD02 94 187.5
    90AH5 3 CN010 PROD03 130 50
      Aggregated Amount of 90AH5 588.01
  3. The Amount field will be populated with the result of the assigned formula on the Rules tab (Quantity * MTCA2.Amount [Channel=90AH5] / 2), where Quantity = Quantity from Data Table 1 and MTCA2./ZQA/ZMT/[Channel=90AH5] = Aggregated Amount of 90AH5 from Data Table 2.

    Channel Account Customer Product Quantity Amount
    90AH5 1 CN007 PROD01 80 23,520.40

    The Amount field will then have this formula:

    Quantity * MTCA2.Amount [Channel=90AH5] / 2

    When we compute the following values for each field, we will have the following output of amount:

    80 * 588,010/2, whereby 588,010 is the aggregated amount of 90AH5 of Data Table 2.

    Channel Account Customer Product Quantity Amount
    90AH5 1 CN002 PROD02 25 7,350.13

    The Amount field will then have this formula:

    Quantity * MTCA2.Amount [Channel=90AH5] / 2

    When we compute the following values for each field, we will have the following output of amount:

    25 * 588,010/2, whereby 588,010 is the aggregated amount of 90AH5 of Data Table 2.

    Channel Account Customer Product Quantity Amount
    90AH5 1 CN009 PROD02 75 22,050.38

    The Amount field will then have this formula:

    Quantity * MTCA2.Amount [Channel=90AH5] / 2

    When we compute the following values for each field, we will have the following output of amount:

    25 * 588,010/2, whereby 588,010 is the aggregated amount of 90AH5 of Data Table 2.

Final Output
Channel Account Customer Product Quantity Amount
90AH5 1 CN007 PROD01 80 23,520.40
90AH5 1 CN002 PROD02 25 7,350.13
90AH5 1 CN009 PROD02 75 22,050.38