How to simplify the following PromQL sentence?

Want to get the average day value of last 7 days or last 30 days like this:
( (amount{area="$area",type="$type"} offset 1d) + (amount{area="$area",type="$type"} offset 2d) + (amount{area="$area",type="$type"} offset 3d) + (amount{area="$area",type="$type"} offset 4d) + (amount{area="$area",type="$type"} offset 5d) + (amount{area="$area",type="$type"} offset 6d)+ (amount{area="$area",type="$type"} offset 7d))/7

While I can use the above sentence for 7 days(and the query result graph is exactly what I expected), the sentence is too long for 30 days. Is there a way to use aggregate or something like loop to simplify that sentence?