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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive