I am trying to build out an aggregate model on a custom object for forecasting. In Salesforce reports you can create formula fields that reference previous group values to create formulas to show percent change in numbers week over week, month over month, etc. Is there some sort of ui-only field functionality in skuid that would allow me to reference a previous value in a table to report the % changes? Thanks!


You should be able to use the Model Lookup function to get corresponding values from the other table and run your calculation as part of the same formula field.


Bill, great idea! It intrigued me so I took it and ran with it. The other key piece that will help here is that you can use Merge Syntax to get access to each Model’s row index within the list of all rows, e.g. first row’s index is 0, 2nd row’s index is 1, 3rd row’s index is 2, etc. So you need to create a Ui-Only number formula field, e.g. a field named “myIndex”, to keep track of the row’s index with formula {{{index}}}. Then you can do a Model Lookup like this where you look up the value of an aggregation / grouping field for the previous row, like this:


For my example page, I did an Aggregate Model on the skuid Page object to see the weekly percent change in the number of Skuid Pages being created in a particular org.

Here’s the XML for this page:

MODEL_LOOKUP("PagesByWeek","countId","myIndex",VALUE({{{index}}}-1)) (({{{prevGroupCountId}}}-{{{countId}}})*100)/{{{countId}}} {{{index}}} {{{yearCreated}}} + "_" + {{{weekCreated}}} line spline area areaspline Calendar Year Week in Year # of Pages created this Week # of Pages created previous week

Zach…I really like the use of the Index as a way to get to the previous value.  Thanks for running with this idea.  I think this example has a lot of uses!  Best!  Bill

Thank you so much for all of your help! This all makes sense, however I copied and pasted the XML to create a new page and the prevGroupCountId (#Pages created previous week) is not returning any values. Do you know what could be causing this?

What version of Skuid are you running?

version 7.7


I am running 7.27.  I was able to install Zach’s page and it is working.

I am not sure what release the Model Lookup function was added.  Can you update to the newest Skuid release?



Bill is right, the MODEL_LOOKUP() function was added in a later release, you should install the latest Skuid version, either Banzai Update 6 or Banzai Update 7. 

Thank you so much Zach and Bill! The update helped! This is skuidtastic! :slight_smile: