Measure complexity analysys code, based on Kamira project

Whenever a measure is saved, the complexity is calculated for each population of the measure
Tweaked the code to allow both children criteria and temporal references.