You can't build stats to count things by the last number of hands like that. You could do something by time, but there is no way to know how many hands that would cover. For example, this post shows how to build a 'recent VPIP' stat, which sounds like the sort of thing you want.