Yes - you can put the expression in a variable and in the place of the expression in your Sheet Object you can use $-sign expansion to evaluate the contents of the variable so it calculates the expression contained in the variable.
The variable can be declared in your load script or via the user interface menu: Settings/Variables Overview/Add or the menu: Settings / Document Properties / Variables Tab / New.
avg_sales = 'Sum( Sales ) / Count( distinct MonthID & '|' & CustomerID )'
And then use this variable like this:
In various places in Sheet Objects that allow expressions.