It would be extremely useful to have a foreach loop in analysis expression e.g. foreach(element in child elements) , foreach(attribute in child attributes). I know that this type of calculation is available in roll-ups, but having this in expressions would give far more power and flexibity to do counts, totals, sub-totals and weighted averages.
Secondly a time based loop with start time, end time and value type (interpolated, average, maximum etc.) e.g for ('AttributeName' from '*-10m' to '*' step '1m', AVE). This would be extremely useful, especially for gradient and rate of change calculations. I realise that this could have massive performance implications if not used sensibly, so there would probably have to be some limits set on the volume of data retrieved, the frequency of the analysis and possibly a timeout. This might make this second idea impractical to actually deliver in a production system.