cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
SQL Alerts are very handy to keep track of any critical metrics. Oftentimes it makes most sense to do a relative comparison of your data. For instance, "alert me if my metric dropped between yesterday and today." The below SQL code is an example of how you can do that!
with
  current_value as (
    select
      count(*) as val
    from
      users
    where
      [created_at:date]=[getdate():date]
  )
  , past_value as (
    select
      count(*) as val
    from
      users
    where
      [created_at:date]=[getdate() - Interval '1 day':date]
  )
select
  current_value.val - past_value.val as difference
from
  current_value
  , past_value
Now, set your alert to trigger every time the output is less than 0! Voila - a relative comparison of your metrics 🙂
Version history
Last update:
‎03-02-2023 09:34 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: