How to obtain differences when data is not updated in real time

I have set up prometheus to GET data from a certain data source on a minute-by-minute basis.
However, that data source only updates data once every 5 minutes.

What is the query to display the natural number of increases in this case?
I want to get the value equivalent to need-avg in EXCEL.

With the irate function, a spike occurs the moment a value is updated, as shown in the image above.

With the rate function, zero occurs at the moment the value switches.