How to get the latest value from range, based on time

I am was having similar issue, using the 6.0.x I was able to display the “single stat” value, But when I migrated to 7.0, It gives me count, (since the singlestat panel is depreceated in 7.0)

Any idea how can I fix this ?