This Use Case became simpler in R21.0.41 with the addition of the now() function in formula. You no longer need to do the first two steps of defining a search window for now and then using a signal to identify the last measured time stamp. Instead you just need to use the now() function to define the capsules and create your condition...
//Create conditions representing the last 7, 14, and 365 days
$Last7DayCapsule = capsule($now()-7d, $now()).setProperty("Time","Last 7d")
$Last14DayCapsule = capsule($now()-14d, $now()).setProperty("Time","Last 14d")
$Last365DayCapsule = capsule($now()-365d, $now()).setProperty("Time","Last 365d")
condition(370d,$Last7DayCapsule,$Last14DayCapsule,$Last365DayCapsule)