How to get the last 7 days average resource usage?

Hi everyone, I’m trying to get the last 7 days average resource usage using the following query :
sum by(pod_container_name) ((sum_over_time(kube_metrics_server_pods_mem{pod_namespace="default"}[7d])) / (count_over_time(kube_metrics_server_pods_mem{pod_namespace="default"}[7d]))) /1024
It gives me information like:

{pod_container_name="service2"}       10.4375
{pod_container_name="service3"}       104.57190091437252
{pod_container_name="service4"}       155.82122150614424```
However, the data from the service1 seems to be wrong as we are running multiple replicas of *service1* which may have restarted several times in a week and new pod created. actual expected value of *service1* is *1500*. All the other services with no replicas seems returning the right value. Any help on figuring this out would be much appreciated. thanks in advance.!