How to convert a Beast Mode with a CASE function in it into an aggregation?
Hello everyone,
Please, do you know how to convert a Beast Mode with a CASE function in it into an aggregation?
I have tried adding a SUM() before the CASE function, I have tried converting the CASE into a number using CONVERT() or CAST().
Thanks in advance!
Comments

what code are you writing?
SUM(CASE WHEN ... then AMOUNT END)
should work fine
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"2 
This is the formula (I changed the names of measures and dimensions):
SUM(CASE
WHEN TRIM(`Car Model`)='Sport Car'
THEN AVG(`Probability of Accident in Decimals`)
ELSE 0
END)
I get the following error when I add the SUM function at the beginning: "An issue has occurred during processing. We are unable to complete the request at this time."
We pull the Probability of Accident in Decimals from Salesforce, we don't calculate it in Domo. Depending on the car model the probability of accident in decimals changes. What happens is that because Domo doesn't see the beast mode as an aggregation then the subtotals and totals are the sum of the average of the probabilities. I need to convert the beast mode to aggregation in order to select average instead of sum.
0 
Hi @user030119
The error is occurring because there's an aggregate function (i.e. SUM) on top of an aggregate function (i.e. AVG), which isn't possible to process in a beast mode.
What could work is to set up AVG(`Probability of Accident in Decimals`) as a separate calculation before Analyzer (for example, as a calculated field in the ETL) and then write your formula using the newly created measure.
There's also the consideration of whether summing up averages is going to give you the right numbers to solve your business problem/situation.
8
Categories
 All Categories
 1.7K Product Ideas
 1.7K Ideas Exchange
 1.5K Connect
 1.2K Connectors
 292 Workbench
 4 Cloud Amplifier
 8 Federated
 2.8K Transform
 95 SQL DataFlows
 601 Datasets
 2.1K Magic ETL
 3.7K Visualize
 2.4K Charting
 691 Beast Mode
 43 App Studio
 39 Variables
 658 Automate
 170 Apps
 441 APIs & Domo Developer
 42 Workflows
 5 DomoAI
 32 Predict
 12 Jupyter Workspaces
 20 R & Python Tiles
 385 Distribute
 110 Domo Everywhere
 269 Scheduled Reports
 6 Software Integrations
 112 Manage
 109 Governance & Security
 8 Domo University
 25 Product Releases
 Community Forums
 39 Getting Started
 29 Community Member Introductions
 98 Community Announcements
 Domo Community Gallery
 4.8K Archive