Top Tips for modeling in Pigment - Performance Optimisation

  • 5 March 2024
  • 2 replies

Userlevel 1
Badge +1

Hi Pigmenteers! 

When reading Top Tips for modeling in Pigment - Part 2: Performance Optimisation, there’s an idea as highlighted in the screenshot below: to avoid doing too much within one metric, there’s “a good guideline is that, if you have to copy and paste part of a formula more than once, it may be worth its own metric” - I don’t quite get it, can you help explain this idea to me? 



Best answer by Nathan 5 March 2024, 09:31

View original

2 replies

Userlevel 6
Badge +11

Hi Thu Mai,


copy paste here means that the same “formula” exists in two metrics as part of a larger one.

We advise for that in order to avoid Pigment recalculating the same thing in several metrics & being able to parallelize calculations.


example of too much recalculations:

Salary = Annual Salary /12 * prorata(month,Employee.Start, Employee.End)

Tax = Annaul Salary / 12 * TaxRate[by:Employee.Country] * prorata(month,Employee.Start, Employee.End)


You should rather do that:

FTE =  prorata(month,Employee.Start, Employee.End)

Salary = Annual Salary /12 * FTE

Tax = Salary *TaxRate[by:Employee.Country]

Userlevel 1
Badge +1

@Nathan oh I got it, your example is very clear, thank you so much!!