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.2K Product Ideas
- 1.2K Ideas Exchange
- 1.3K Connect
- 1.1K Connectors
- 273 Workbench
- Cloud Amplifier
- 3 Federated
- 2.7K Transform
- 78 SQL DataFlows
- 524 Datasets
- 2.1K Magic ETL
- 2.9K Visualize
- 2.2K Charting
- 434 Beast Mode
- 22 Variables
- 510 Automate
- 114 Apps
- 388 APIs & Domo Developer
- 8 Workflows
- 26 Predict
- 10 Jupyter Workspaces
- 16 R & Python Tiles
- 332 Distribute
- 77 Domo Everywhere
- 255 Scheduled Reports
- 66 Manage
- 66 Governance & Security
- 1 Product Release Questions
- Community Forums
- 40 Getting Started
- 26 Community Member Introductions
- 67 Community Announcements
- 4.8K Archive