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
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 308 Workbench
- 6 Cloud Amplifier
- 10 Federated
- 3.8K Transform
- 660 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 815 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 780 Automate
- 191 Apps
- 482 APIs & Domo Developer
- 84 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 21 AI Chat
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 414 Distribute
- 122 Domo Everywhere
- 281 Scheduled Reports
- 11 Software Integrations
- 146 Manage
- 142 Governance & Security
- 8 Domo Community Gallery
- 49 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive