Can this be built with a card and beast mode without pre aggregating
HI,
As the title says can this be built without having to pre aggregate the data via a view or ETL.
I have hourly data for 14 days. 7th Jan 2019 to 20th Jan 2019. data set is much larger but as an example. So the data is datetime and a count figure.
e.g.
07/01/2019 01:00 6
07/01/2019 02:00 9
07/01/2019 03:00 10
07/01/2019 04:00 12
07/01/2019 05:00 15
...
...
08/01/2019 01:00 9
08/01/2019 02:00 33
08/01/2019 03:00 122
08/01/2019 04:00 11
08/01/2019 05:00 66
I need the average count for each day of the week.
So the average for a Monday, Tuesday etc.
I can do this in SQL and I can also do this using the group by in the domo views and ETL by aggregating the data to the day of the week and then using the average in the card builder.
The problem is I want the user to be be able to filter the hours that make up the aggregation on the fly within the card
e.g. just see between midday and 3pm etc.
Does anyone know how I can achieve this as once the group by is done I have lost the hours in the card analyser and using a window function within beast mode won't allow anything like
avg(sum(incount) OVER (partition by DATE(datetime), DAY(datetime))
Thanks
Answers
-
I'm not sure what chart type you are using, but I believe I was able to do this with three beastmodes. One to get the name of the day and another to capture the hour from your datetime field.
HOUR:
HOUR(`DateField`)
Week Day:
DAYNAME(`DateField`)
Avg Total Count:
AVG(SUM(`Count`)) FIXED (BY day(`DateField`))
You can then see the average total for any day of the week. You can also filter to only include certain hours or only values between certain dates.
1 -
Hi,
Thanks for replying.
I didn't know the FIXED function was available yet. I have tried this and it seems to give different results to using.
SUM(`INCOUNT`)/COUNT(DISTINCT DATE(`DATETIME`))
I'm not quite sure why, I have a PIE chart grouped by DAYOFWEEKNAME and then I used your example.
Thanks
Paul
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 656 Datasets
- 115 SQL DataFlows
- 2.2K Magic ETL
- 813 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 81 App Studio
- 45 Variables
- 771 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 77 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 410 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive