Show max values as indicator

Hey, I have a a PV system and want to show a line in my graph that shows what have been the highest values for my system for each point in time of the day.

So basically a query that collects the data of the last e.g. 30 days and takes at each point in time the max of these 30 days. That way I can compare the current output/performance to the last days.

I found a lot of examples that output the current max. But that is obviously not what I want.