Setting alert conditions based on percentage changes of data values

You can create an alert to send an email or a Slack notification whenever the results from a query-based or Look-linked dashboard tile meet or exceed a specified threshold. Looker creates alerts based on comparisons of whole number and decimal data values. Using the workaround described on this page, you can also set alerts based on percentage changes of data values.

To set an alert condition based on a percentage change in data values, your query must contain a date field.

To receive an alert notification when a percentage change in data values has met or exceeded a specified threshold::

Example

For example, a user wants to compare the percent change in average temperature in San Francisco each hour. The goal is to send an alert each time the temperature increases by more than two percent.

If the current period's average temperature is 100, then that alert would be triggered if the temperature becomes greater than 102, a change of more than two percent. If the 102+ then increases by more than two percent again, then another alert will be triggered.

To compare percent values, create a table calculation and use it to set the alert:

  1. Create a table calculation that computes the percent change row over row.

    (${measure_name} - offset(${measure_name},1))/offset(${measure_name},1)
    You can also use the % change from previous row shortcut calculation.
  2. Set the table calculation Format to Percent and specify the number of Decimals to show.
  3. Save the table calculation.

    The data table shows Average Temperature by Hour, pivoted by City. A new table calculation shows the percentage temperature change row over row.
  4. Save the Explore as a dashboard tile, if it is not already saved to a dashboard.
  5. Create a new alert based on the new table calculation. In the alert creation pop-up, select increases by and enter "0.02".