Metric with allocation

  • 21 July 2022
  • 2 replies

Userlevel 1

Hello community 😊

I need to realocate offer amount in proportion of GMS order weight on checkout GMS total weight (i.e. 1 checkout contains X orders). Below you have for example Order 1303589 representing 44% of checkout 351970. Then, i need to relocate 44% of my amount offer to this order.


I take the amount offer in a transaction list “LT_Offer”:

See below the “TL_Offer”. I want a metric which returns in column the checkout ID, the order ID and reallocated offer amount (which is the offer amount * allocation_order_on_checkout metric)

Condition: I only want computing allocated amount offer when the Id_order in TL_Offer is empty (in fact, if there is an id_order, the amount have been already assgined to the order). 

Here in the same example, i need to reallocate 59€ at 44% to the first order and 56% to the 2nd order.

Knowing that I have a mapping between order_id and checkout_id in the order_id dimension:


I want this final metric working:


Thanks a lot ;) !! 


Best answer by Nathan 22 July 2022, 09:52

View original

2 replies

Userlevel 4
Badge +4

Hi Alix,


you can do it this way:


Step 1: [filter:isblank(TL_Offer.id_order)] is your condition, so not doing anything for when it is already allocated

Step 2: [by sum:TL_Offer.id_checkout] = aggregate the values at the checkout level

Step 3: [by constant:id_order.'checkout ID'] = allocate that value on each id order

Step 4: multiply by your ratio

You easily bring that result into your TL as well by doing a BY on this metric


Userlevel 1

Thanks a lot!!! It’s working :D