Beast Mode Help - Special Rounding Case (round at up at .25)
Here is a video that gives an overview of what I am trying to do with a beast mode.
Best Answers
-
Here you go:
`Current` - (FLOOR(`Needed`) + CASE WHEN MOD(`Needed`, 1) >= .25 THEN 1 ELSE 0 END )
FLOOR returns the whole number part of `Needed`
MOD(`Needed`,1) returns the decimal part
We then do a CASE WHEN to see if the decimal is >= .25, if so then return 1 and add it to the whole number of needed.
Let me know if you have any questions,
ValiantSpur
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.2 -
It's working! I was able to work it out by doing a bunch of the row calc in the Magic ETL instead of doing that in the Beastmode. More detail in this video: https://youtu.be/h9YTqTEYXKo
Here is my simplified Beastmode after the changes I made:
`Current Head Count` - (FLOOR(`Required Resources`)
+ CASE WHEN MOD(`Required Resources`, 1) >= .25 THEN 1 ELSE 0 END)1
Answers
-
Here you go:
`Current` - (FLOOR(`Needed`) + CASE WHEN MOD(`Needed`, 1) >= .25 THEN 1 ELSE 0 END )
FLOOR returns the whole number part of `Needed`
MOD(`Needed`,1) returns the decimal part
We then do a CASE WHEN to see if the decimal is >= .25, if so then return 1 and add it to the whole number of needed.
Let me know if you have any questions,
ValiantSpur
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.2 -
First, the special rounding solution you provided is working great! I am getting a strange summary number/column total I wanted to run by you. When I export the table data from Domo to Excel and sum the column I get a value of 13, the summary number and the total on the column in the Domo table card is showing as 24.
Attached is sample data, and here is a video help explain: https://youtu.be/XJjJnYYSmb0
Here is my beastmode:
SUM(`Current Head Count`) - (FLOOR(
SUM(`Total RR`)
+SUM(`Support - Current`)
+SUM(CASE when `Total RR`>6 then `RR SUP Raw` else 0 END)
+SUM(CASE when `Total RR`>4 then 1 else 0 END)
+SUM(CASE when `Mayer Branch`='200 - Birmingham' then 1 else 0 END))+ CASE WHEN MOD(
SUM(`Total RR`)
+SUM(`Support - Current`)
+SUM(CASE when `Total RR`>6 then `RR SUP Raw` else 0 END)
+SUM(CASE when `Total RR`>4 then 1 else 0 END)
+SUM(CASE when `Mayer Branch`='200 - Birmingham' then 1 else 0 END), 1) >= .25 THEN 1 ELSE 0 END )1 -
Definitely pretty tricky, took me a minute to figure out what was going on.
So the data at the row level is exactly the same. The problem is that the Total and Sum fields, don't calculate our special rounding at the row level, it does it on the whole dataset.
Example:
If you had 3 rows where the decimal was .25, .28 and .30 at the row level then you would end up saying the required amount was +3 the whole number actually required. But at the summation level, it says the decimal for those 3 is .83 so it's only +1.
That difference is what's causing the offset in your numbers.
The only way around it I believe would be at the ETL level and then just display a clean card to summarize.
Hope this helps,
ValiantSpur
1 -
How would I approach this rounding issue in the Magic ETL? The calculation step only contains very simple math operators.
2 -
Basically I would use a SQL Transform to rebuild the base dataset
SELECT *, 'Insert Variance BeastMode Here' AS 'Variance'
FROM DatasetAnd you can SUM any of the fields you're summing ahead of time.
But that should produce a dataset that is exactly what you would export from the finished card.
1 -
It's working! I was able to work it out by doing a bunch of the row calc in the Magic ETL instead of doing that in the Beastmode. More detail in this video: https://youtu.be/h9YTqTEYXKo
Here is my simplified Beastmode after the changes I made:
`Current Head Count` - (FLOOR(`Required Resources`)
+ CASE WHEN MOD(`Required Resources`, 1) >= .25 THEN 1 ELSE 0 END)1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive