Sudden Beastmode error
Hi there!
I have a card, which uses a lot of beast mode calculations.
All of a sudden. I get this error:
"You have a divide by zero error in your Card´s Beast Mode / Link: Get help in Domo´s Knowledge Base"
So, I checked everything and I was told that I needed a case function to avoid 0 division, also checked DOJO topics, which stated the same.
My problem is that:
- I already use case functions to avoid problems like this one:
"(sum(case when `field1` is null then 0 else `field1` end)+
sum(case when `field2` is null then 0 else `field2` end))
/
(sum(case when `field3` is null then 0 else `field3` end)+
sum(case when `field4` is null then 0 else `field4` end))
-1"
- My card is YTD, in my understanding it is simply not understandable that the card worked yesterday, but not today, because new data is only added.
Does someone experienced a related problem?
Many thanks
Best Answer
-
Does your card have any granularity, like a table card with a dimension with lots of variety, where at least one of those combinations might have a divide by zero error? Like a new salesrep who doesn't have any sales yet and might not have the data used in the denominator.
I fixed a card like this for us yesterday with that same error, with logic somewhat like this :
CASE
WHEN
ifnull((sum(case when `field3` is null then 0 else `field3` end)+
sum(case when `field4` is null then 0 else `field4` end)),0) = 0THEN 0
ELSE
"(sum(case when `field1` is null then 0 else `field1` end)+
sum(case when `field2` is null then 0 else `field2` end))
/
(sum(case when `field3` is null then 0 else `field3` end)+
sum(case when `field4` is null then 0 else `field4` end))
-1"END
If the denominator is zero or null, then return zero instead of dividing by null or zero.
Beast modes with case statements having aggregations can be a tricky thing, so YMMV.
Aaron
MajorDomo @ Merit Medical
**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
Answers
-
Does your card have any granularity, like a table card with a dimension with lots of variety, where at least one of those combinations might have a divide by zero error? Like a new salesrep who doesn't have any sales yet and might not have the data used in the denominator.
I fixed a card like this for us yesterday with that same error, with logic somewhat like this :
CASE
WHEN
ifnull((sum(case when `field3` is null then 0 else `field3` end)+
sum(case when `field4` is null then 0 else `field4` end)),0) = 0THEN 0
ELSE
"(sum(case when `field1` is null then 0 else `field1` end)+
sum(case when `field2` is null then 0 else `field2` end))
/
(sum(case when `field3` is null then 0 else `field3` end)+
sum(case when `field4` is null then 0 else `field4` end))
-1"END
If the denominator is zero or null, then return zero instead of dividing by null or zero.
Beast modes with case statements having aggregations can be a tricky thing, so YMMV.
Aaron
MajorDomo @ Merit Medical
**Say "Thanks" by clicking the heart in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
Hi, thanks for you help!
You were right, one field was the trouble maker.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive