Putting together the answer of @daniel-andersen and his comment, peak memory usage (as shown by the top tool) for a day can be obtained with:
atopsar -R 1 -m -r /var/log/atop/atop_20240904 | tail -n+7 | awk '{print $2-$3-$4-$5}'| sort -n | tail -n4
Which outputs the sorted memory usage in megabytes like so:
6366
7619
7852
15688
This is useful, if the server has much more RAM than is used and one wants to know if it can be scaled down.
You can also loop through whole months and get the maximum RAM usage for each day:
for f in /var/log/atop/atop_202408*; do
atopsar -R 1 -m -r $f | tail -n+7 | awk '{print $2-$3-$4-$5}'| sort -n | tail -n1
done