Displaying count with latest timestamp

I want to display a ‘current number of logged users in my system’, on Grafana dashboard.

I have an api that returns number of currently logged in users and their ids.

Let’s say I want to display the number in SingleStat panel.

There will be another process that will periodically call the above api and insert current number of users to influxDB.

name: users
    time                ids       ucount 
    ----                ---       ------ 
    1502285542496852100  "6"           1
    1502285635674168900  "6,4,11"      3
    1502285754186018900  "6,4"         2

Then in Grafana how should I configure SingleStat to show the latest ucount?

I am expecting to see: 2 (as it was the latest update)

Maybe my approach for this is completely wrong?

Just select last(ucount) …

How to pick the grafana start and end timestamp in template,
pls any one explain with syntex