Beast Mode windows function
Hey there I am trying to do a 5 day rolling change in value based on usage. I want to show previous five days compaired to the newest date.
I have tried this beast mode:
((Lag (`QUANTITY`,5) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,6) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,7) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,8) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,9) OVER (Order BY `TimeStamp(use)`))/5)
-
((`QUANTITY`
+Lag(`QUANTITY`,1) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,2) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,3) OVER (Order BY `TimeStamp(use)`)
+Lag(`QUANTITY`,4) OVER (Order BY `TimeStamp(use)`))/5)
however its giving an error. Any other thoughts?
on a side note we do have the window functions enabled.
thanks!
Comments
-
https://www.youtube.com/watch?v=cnc6gMKZ9R8
I did something like this in a tutorial video.
I think you need LAG(sum(quantity) , n )
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 -
Thank you so much. I have not had a chance to look close at the video as my day got away from me.... I did quickly try adding in sum but still getting an error. Will look at the video closer tomorrow. Really appreciate it!
0 -
@kacy no worrieis.
Pare a test function down to just one LAG() function.
Make sure that you're including `TimeStamp(use)` in the GROUP BY clause of the SQL function your table generates. The LAG() function must have the same granularity as the number of rows in your final visualization. (so Timestamp, must be on an axis or the SORT BY clause).
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
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