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
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 302 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 104 SQL DataFlows
- 633 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 760 Beast Mode
- 62 App Studio
- 42 Variables
- 699 Automate
- 181 Apps
- 457 APIs & Domo Developer
- 51 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 401 Distribute
- 116 Domo Everywhere
- 277 Scheduled Reports
- 8 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 111 Community Announcements
- 4.8K Archive