Percent/Absolute Change WoW as a Beast Mode Column
Hello,
I am a cardbuilder for my organization and I am having a tough time getting a Week over Week beast mode calculation correct. Our calendars are set on an admin level so the fiscal week is Monday - Sunday. In the screenshot attached, I want to show the % change WoW for the metric "Clicks". I want it so it will automatically do a WoW change based on the time period I select. Right now my formula is only for the prior week.... my questions are
1) What exactly is wrong with my formula? the output (See screengrab) is not the correct change
2) How would I code it so it will always do a WoW change based on the time period I choose for the table? Right now it's just for the prior week
((SUM(CASE WHEN WEEK(`Date`) = WEEK(CURRENT_DATE()) THEN `Clicks` ELSE 0 END)
- SUM(CASE WHEN WEEK(`Date`) = WEEK(CURRENT_DATE()) - 1 THEN `Clicks` ELSE 0 END))
/
NULLIF(SUM(CASE WHEN WEEK(`Date`) = WEEK(CURRENT_DATE()) - 1 THEN `Clicks` ELSE 0 END), 0))
Comments
-
The reason your % Change isn't working is because you have Date / Week on the axis.
If you put a Date on the axis, then your beast mode only has access to the data related to THAT date. So it's impossible to know what the value was for the preceding date, b/c it's not accessible. Imagine your data is an excel spreadsheet. You wouldn't be able to calculate percent from last week without referencing the data from last week, which would be on a different row! (accessing data on a different row is the part that isn't possible.)
this video https://www.youtube.com/watch?v=CDKNOmKClms&t=587s will show you how to accomplish your requirement.
Last thought. Be careful with your Week() function. The Week function will be a standard SQL implementation whose start of week is not necessarily related to your calendar week.
I always recommend creating your own Date Dimension table where you explicitly declare the day of the week so you can avoid doing the calc in beast modes.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
- 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