You’re right, and I should have made that clear in my original explanation. I was assuming that you had device(s) reporting data at a regular interval.
If you set a duration of 5 minutes, and no devices within your query reported a state value for the chosen attribute within that time, you will not be returned a value regardless of the selected aggregation method. However, if you set the duration to “Last received data point”, the query will go back in time until it retrieves a value for the attribute and the devices given.
On this subject, note that we only hold on to your application data for a set period of time - otherwise known as a “TTL”. You can view your organization’s TTL in the usage table on your organization’s overview page or within your org’s “Current Usage” page. If the application is owned by a Sandbox, you’ll find that information under the “Sandbox” link in the “Organizations” tab.
So, if you make a gauge query with “Last received data point”, and the last point was reported 45 days ago but the application’s TTL is only 30 days, the query will not return a value as the data is no long stored within Losant.