Control what records formulas consider

It would be really useful if formulas could consider only a certain number of records based on the records. For instance, if I could choose only to average the most recent 3 records. I don't believe this is possible at present.