Count transactions AND sum quantity on specific transactions by type

user18872
Member
in Beast Mode
I have a card that counts the transactions type by month. Some of the transactions have a quantity so I need to sum the quantity instead of just counting that transaction one time. I'm not quite sure how to go about that. I need to be able to say if it is this type of transaction then sum the quantity otherwise count the transaction. My attempts at a best mode have not worked out.
0
Best Answer
-
Are your transactions duplicated?
If not you could do a conditional sum like:
SUM(CASE WHEN `transaction_type` = 'Quantity' THEN `quantity` ELSE 1 END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3
Answers
-
Are your transactions duplicated?
If not you could do a conditional sum like:
SUM(CASE WHEN `transaction_type` = 'Quantity' THEN `quantity` ELSE 1 END)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 -
Agree with @GrantSmith.
Another calc that would count the transaction as 1 if there is no quantity would be sum(ifnull(`quantity`, 1)).
0 -
Thank you! This worked perfectly! I tend to overthink things.
0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 308 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 662 Datasets
- 118 SQL DataFlows
- 2.2K Magic ETL
- 821 Beast Mode
- Visualize
- 2.6K Charting
- 85 App Studio
- 46 Variables
- Automate
- 193 Apps
- 483 APIs & Domo Developer
- 85 Workflows
- 23 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 3 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 116 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 142 Governance & Security
- 10 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 5K Archive