Beast Mode Calculation
Hi Everyone,
Trying to come up with a beast mode calculation to calculate the percent difference between last weeks count and this weeks count.
This is the example of how the data would look:
Also I would like to know how to do a rolling 4 weeks count so an additional field with header 4 week count and then the percent difference between the four weeks count.
Let me know please and thanks!
Answers
-
@Shumilex I would point you to this post by @GrantSmith that should do the trick for you. You would add an extra calculation to divide the current week number from the previous week.
https://dojo.domo.com/discussion/52679/domo-ideas-conference-beast-modes-rolling-averages#latest
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Hi @Shumilex
I'd recommend utilize a custom date offset where you can compare one date to a different date. In your case you're just wanting to know the value from last week. I've done a write up / walk through of this methodology before. You can find more information here: https://dojo.domo.com/discussion/53481/a-more-flexible-way-to-do-period-over-period-comparisons#latest
You'd then just need to calculate your percentage difference:
(SUM(CASE WHEN `Period Type` = 'Current' THEN `Value` END) - SUM(CASE WHEN `Period Type` = 'Last Week' THEN `Value` END)) / WHEN `Period Type` = 'Last Week' THEN `Value` END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
To address the 4 week rolling average you could utilize the LAG window function however you'd need to have 28 different LAG functions (I'm assuming your date has a day grain and not a week grain here. If you have it by week this becomes easier and you can refer to the post @MarkSnodgrass mentioned) called in your beast mode which is a bit much to write. What I might also recommend is to have a 2 weeks ago, 3 weeks ago and 4 weeks ago offset you define and then just tweak your PoP beast mode (this is assuming you want weeks 0-3 vs 1-4 if not you could apply the same method for weeks 5-8):
(SUM(CASE WHEN `Period Type` IN ('Current', 'Last Week', '2 Weeks Ago', '3 Weeks Ago') THEN `Value` END) - SUM(CASE WHEN `Period Type` IN ('Last Week', '2 Weeks Ago', '3 Weeks Ago', '4 Weeks Ago') THEN `Value` END)) / WHEN `Period Type` IN ('Last Week', '2 Weeks Ago', '3 Weeks Ago', '4 Weeks Ago') THEN `Value` END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive