How to verify if the last value changed from last query?

Hello!

I store every 5 minutes how many clients is online at determinated room.

So, I have a dumb question, I would like to verify if the current clients online is much lower from last query, so I can call some alarms.

Example data is:
value, time
50 2022-11-25 15:00:00
50 2022-11-25 15:05:00
50 2022-11-25 15:10:00
20 2022-11-25 15:15:00 <<< When this occurs I would like to send an alarm.

How to query this with flux?

Thank you in advanced.

I would use the difference() function, which returns the difference between subsequent values.

Then configure your alert to detect when the value returned by difference() is at least 5 (or 20 or whatever number you feel is appropriate.