Aggregate Models (Combine Results from Two Aggregate Models)

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have three custom objects: Sale, Expense and Lead Source. Lead Source is a parent object on both Sale and Expense. I’ve created two Aggregate Models that work fine and show the following:

Sales Per Lead Source
(Aggregates Sales Model that Groups by Lead Source)

Lead Source---------- ---Gross Profit
Cars.com -----------------$10,000
Autotrader.com---------$11,000

Expenses Per Lead Source
(Aggregates Expense Model and Groups by Lead Source)

Lead Source--------------Total Expenses
Cars.com------------------$5,000
Autotrader.com----------$4,000

Is there a way to combine the results from the two models. In my case, I’m trying to calculate the Marketing Return on Investment for the company’s various lead sources. Formula is (Gross Profit - Expenses) / Expenses. Ideally, the table would like the following:

Lead Source----------Total Sales-----------Total Expenses-----------Return on Investment
Cars.com ----------------$10,000-------------------$5,000-------------------------100%
Autotrader -----------------$5,000 ----------------- $4,000--------------------------25%

Is this possible using Aggregate Models in SKUID?

Any help steering me in the right direction is sincerely appreciated.
Photo of Michael Gates

Michael Gates

  • 104 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Raymond.  That is exactly right. 
Photo of Michael Gates

Michael Gates

  • 104 Points 100 badge 2x thumb
Thanks guys! The syntax for lookup fields provided in your link worked perfectly.

MODEL_LOOKUP("ModelName","FieldNametoBeReturned","FieldNameToMATCHinCurrentModel",{{MatchingValueFromCurrentModel}})