Issue with basic calculation causing card to error out

I am trying to do what I normally would think of as a basic calculation in beast mode, but it is continuting to error out my card as soon as I add it to the table. I want to devide my revenue per client by the number of distinct cutomers. My table looks like this
Client Customers Retail Avg Customer
Smith 4 100 25
in Excel I would calculate this as Retail/Customers, and it works fine.
So far in beast mode i have successfully written the count distinct portion as
(COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`))))
I have validated that it is correctly counting my customers against my original data set, so that part is correct.
I then tried to use the count distinct in the calculation of
`Retail`/ (COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`))))
The formula validates when in Beast mode, but when I actually attempt to use it I reveive this error
Best Answer
-
Give this a shot. I think I ran into this a while back and had to include a CASE WHEN just in case there was the opportunity for a divide by 0.
`Retail`/
CASE WHEN
COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`))) <> 0
THEN COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`)))
ELSE 1 ENDBest of luck,
Valiant
0
Answers
-
Give this a shot. I think I ran into this a while back and had to include a CASE WHEN just in case there was the opportunity for a divide by 0.
`Retail`/
CASE WHEN
COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`))) <> 0
THEN COUNT(DISTINCT (CONCAT(`Patient`,'',`Patient Address`,'',`Patient City`,'',`Patient Phone`)))
ELSE 1 ENDBest of luck,
Valiant
0 -
Thank you so much!! It worked.
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 308 Workbench
- 7 Cloud Amplifier
- 10 Federated
- 3.8K Transform
- 661 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 820 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 781 Automate
- 193 Apps
- 483 APIs & Domo Developer
- 85 Workflows
- 23 Code Engine
- 43 AI and Machine Learning
- 22 AI Chat
- 3 AI Projects and Models
- 18 Jupyter Workspaces
- 409 Distribute
- 116 Domo Everywhere
- 282 Scheduled Reports
- 11 Software Integrations
- 146 Manage
- 142 Governance & Security
- 9 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive