Variantion of energy meter hourly sensor

Hello,

i have an utility meter sensor defined like this:

utility_meter:
  gas_consumption_hourly:
    source: sensor.gaszahler
    cycle: hourly

The result is this:

But i would like to have somthing like the red line in the second graph.
I mean to display the highest value of the utility meter every hour. And no increasing value within an hour.

But i have no clue, how to achieve this…