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.5K Product Ideas
- 1.5K Ideas Exchange
- 1.4K Connect
- 1.1K Connectors
- 280 Workbench
- 4 Cloud Amplifier
- 4 Federated
- 2.7K Transform
- 90 SQL DataFlows
- 563 Datasets
- 2K Magic ETL
- 3.4K Visualize
- 2.3K Charting
- 592 Beast Mode
- 13 App Studio
- 28 Variables
- 588 Automate
- 143 Apps
- 417 APIs & Domo Developer
- 27 Workflows
- 1 DomoAI
- 28 Predict
- 12 Jupyter Workspaces
- 16 R & Python Tiles
- 361 Distribute
- 99 Domo Everywhere
- 260 Scheduled Reports
- 2 Software Integrations
- 94 Manage
- 91 Governance & Security
- 9 Product Releases
- Community Forums
- 37 Getting Started
- 28 Community Member Introductions
- 90 Community Announcements
- 4.8K Archive