Alert Bases on Average for Day of Week
For a daily alert, we can not merely measure the difference between two consecutive days because day of week matters - we have much lower traffic on the weekends, a Monday peak followed by a typical slow decline.
What I would like to do for an alert is something like this:
For the particular day of week, if variance of the count of records is more than +/- 20%, as compared to the AVERAGE COUNT count of records for the same day of week over the last 60 days, then alarm.
I have messed with beast modes, and don't want to do a data flow if i don't have to. Any suggestions? Thanks.
Because you're wanting to do an average of the count (an aggregate of an aggregate) BeastMode won't be able to help you. You'll need to utilize a data flow to track your running total / count and then you could utilize a beast mode to calculate the difference between your current day's value and the average count.**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
So, a whole new table that tracks a rolling average? Probably one column per day so that i could keep the rolling averages and get trending? Or should i just have one column with 7 rows that get update daily? Thanks.0
If you don't care about keeping a historical record you could do it with the MagicETL
- Date Operation to get the Day of Week on your main data set
- Split your main dataset using a filter to pull the last 60 days
- Group On Day of Week - calculating the average
- Join this grouping back to your original dataset (that you fed into the group by) based on the day of the week
- Can either calculate the difference between the day in the ETL or in a BeastMode and utilize that as your summary number to alert on.**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Still having trouble with this, might just be my understanding.
Mainly, i want average by day of week for each vendor.
Then, in my main data, i want to alert comparing the current day to the average for that day for that vendor, and alert off of a percent difference.
I have a stacked bar for each day, with vendor as the series. All I need to do is, for each vendor, compare their numbers to their average for that day of week.
If I follow your method above, should my new data table only contain counts or averages per vendor per day? And if i join that back to the main data (individual transactions), on what do i join it? Do I add the average value to each row for each vendor to each individual transaction? If so, how will that be referenced against the graph's summary numbers for each vendor, since that summary appears on every row?
Thanks from a newb0
@GrantSmith could you do something like
sum(1) as daily_record_count,
avg(sum(1)) over () as 60_day_rolling_avg ,
avg(sum(1)) over ()
avg(sum(1)) over () as percent_Change
DATEDDIFF(date, current_date()) between 1 and 60
GROUP BY date
EDIT:: pardon my pseudocode, i'll try to test later.Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0
Thanks so much for your prompt answer. But then how does the join work back to the individual transaction data?0
So for my first query, I've created this (as a transform). Not sure how to now add a count for just one day (yesterday). Also, not sure if a transform works because then how do i pull data from both this transform and the original data table for the one day count?
count(*) AS SIXTYDAYCOUNT
, CURRENT_DATE-1 as Date
`INSRT_DTTM` between CURRENT_DATE-61 and CURRENT_DATE-1
So the more I think about this, what i need i one output is
A rolling 60d average
A count for yesterday
Got to be easy, but...0
- 7.7K All Categories
- 12 Connect
- 925 Connectors
- 247 Workbench
- 441 Transform
- 1.7K Magic ETL
- 61 SQL DataFlows
- 456 Datasets
- 88 Visualize
- 222 Beast Mode
- 2.1K Charting
- 8 Variables
- 35 Cards, Dashboards, Stories
- 5 Automate
- 349 APIs & Domo Developer
- 85 Apps
- 17 Predict
- 3 Jupyter Workspaces
- 14 R & Python Tiles
- 242 Distribute
- 60 Domo Everywhere
- 241 Scheduled Reports
- 18 Manage
- 39 Governance & Security
- 46 Product Ideas
- 1.1K Ideas Exchange
- 6 Community Forums
- 19 Getting Started
- 6 Community Member Introductions
- 50 Community News
- 18 Event Recordings
- 577 日本支部