Beast mode adding two columns with conditions
Hello Dojo,
I'm having trouble adding two columns with in a conditional case. The following works fine:
SUM(`paid_total`) + SUM(`booked_total`)
But then when I try to add any sort of condition, it fails: "An issue has occurred during processing. We are unable to complete the request at this time."
case when `payment_number` >= 1 then SUM(`paid_total`) + SUM(`booked_total`) else 0 end
I've tried wrapping the whole statement in a SUM as it suggests to do in the docs, but that also doesn't work.
SUM( case when `payment_number` >= 1 then SUM(`paid_total`) + SUM(`booked_total`) else 0 end )
Any thoughts here? I've exhausted every other help page on this topic I could find in the Dojo, to no avail.
Answers
-
CASE WHEN `payment_number` > 0 THEN SUM(SUM(`paid_total`) + SUM(`booked_total`)) ELSE 0 END
1 -
Domo cannot apply a CASE statement AFTER the aggregate.
If you need to apply a CASE statement on the aggregate, then you have to pre-aggreagte the data in ETL or a Dataset View.
(you could then JOIN the preaggregated data back onto the transactions to retain the granular detail.
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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive