Sum True

This sounds so dumb and simple. But I'd give my left leg to be able to sum a true/false column and have it give me a sum of True (basically treating it like a 1 and 0) without having to do a beastmode calculation.
Comments
-
Can't you just do the following?
SUM(`your_boolean_column`)
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
That was what I thought but I've had no luck. My SQL query brings it in as a string, is there anything in particular to turn it into a boolean, keeping true/false as the content (for user filters)? Right now I toss in a calculation that says true = 1 and false = 0, but that leads ultimately having two columns for me to manage insights into a single column. Below is a screenshot of the original sql output.
0 -
Boolean sum depends upon whether you mean Boolean Summation as a logical "or". Using a formula like the following would give you the logic that if any one of the values is true the result is true.
MAX(CASE WHEN `boolean_number` THEN 1 ELSE 0 END)
Domo is not going to be able to do the summation on a string value. Try casting it to a Boolean true/false or 1/0. If you are working with string values and you want to return a one if any row contains true the something like
MAX(CASE WHEN LOWER(`your_column`) = 'true' THEN 1 ELSE 0 END)
might work for you. But alas…this is a Beast mode calculation which you hope to avoid.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 663 Datasets
- 119 SQL DataFlows
- 2.3K Magic ETL
- 823 Beast Mode
- Visualize
- 2.6K Charting
- 86 App Studio
- 46 Variables
- Automate
- 193 Apps
- 483 APIs & Domo Developer
- 86 Workflows
- 23 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 117 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 143 Governance & Security
- 11 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 116 Community Announcements
- 5K Archive