You can use a replace a variable in the String using '$', e.g. $numdays.  Try something like this (scope is a VMWCluster):  then = null numdays = 180  while (then == null) {       try {            String query = "virtualMachinesPoweredOnCount from VMWCluster:name = '$scope.name' for 1 day $numdays days ago"            then = max(server.QueryService.queryObservations(query))      }      catch (Exception e) {}      numdays-- }  '' + numdays++ +  ' days ago there were ' + then + ' VMs powered on'  My result: 56 days ago there were 3.0 VMs powered on  Regards, Brian Wheeldon
Looking for some assistance in creating a derived metric that would take a point in time metric from say 6 months ago, "poweredOnVMCount", subtract it from the current "poweredOnVMCount" and divided it by the number of days between the two metrics effectively providing the daily growth. Any assistance would be appreciated.  Thanks,  Joshua 
VM Growth Over Past N Days Derived Metric