Run rate beastmode calculation
Hi all, trying to formulate a beastmode calculation to give me weekly run rate so I can do a WoW chart. No matter how I modify the query, I keep getting a "Calculation Error : All fields must be aggregated or in the group by clause". This is the first time I am seeing this error. Any insights and advice would be appreciated. Query is below, let me know if there are any glaring flaws that I'm just not seeing.
SUM(CASE WHEN Category
= 'Revenue' AND YEARWEEK(Date
) = YEARWEEK(CURRENT_DATE()) THEN Amount
ELSE 0 END) /
COUNT(DISTINCT CASE WHEN Category
= 'Revenue' AND YEARWEEK(Date
) = YEARWEEK(CURRENT_DATE()) THEN Date
END)
Answers
-
@tmerchant I just tried your beast mode using some sample data, and didn't run into the same error. With that being said, one thing I would recommend is to break your beast mode into parts, and test those parts to figure out where the problem is originating from. For example, take
SUM(CASE WHEN Category = 'Revenue' AND YEARWEEK(Date) = YEARWEEK(CURRENT_DATE()) THEN Amount ELSE 0 END)
and run it by itself. If that works, then do the same for the second part of the beast mode. Once you identify the source, you can do some more digging to figure out what's causing the issue.
The error doesn't really make it sound like this is the issue - but also be sure to check that the columns you're referencing are the correct type. E.g. - Amount is numeric, date is actually a date field.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**0 -
hi @david_cunningham thank you for your reply! tried breaking it up and am immediately running into Calculation Error : Aggregate functions are not allowed in this context: 'SUM'. which is another error I'm seeing for the very first time. I know this is a typical error for WHERE nested within SUM, which isn't the case here. Any idea why this might be?
0 -
@tmerchant this error I would guess is coming from attempting to do the calculation in a Magic ETL formula tile, which does not allow aggregation. It will run in a beastmode on a card as @david_cunningham tested. If you want this to be in a Magic ETL formula, use a Group By tile instead, select the columns groupings and define the formula in that field. Try that and let us know!
Jacob Folsom
**Say “Thanks” by clicking the “heart” 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