Simple Beast Mode Failing on Federated Dataset
I've got a federated dataset pulling a redshift table and I want to perform some simple calculations like SUM(column1) / COUNT(column2).
However, this calculation is resolving to 0 consistently despite the correct value being about 0.2.
If I write a beastmode for SUM(column1) I get the correct value. And if I do the same for Count(column2) I also get the correct value - just not when I divide them.
My hypothesis was that this was some kind of timeout issue with our database connection settings, like this one: https://dojo.domo.com/discussion/53003/beast-mode-processing-limitations
But 1) I also get some pretty funny values if I write beastmodes like 5/4 (this resolves to 1.00000!) or 5/6 (this resolves to 0.0000).
AND 2) I've limited the dataset to just 1000 rows
So I'm wondering whether it's not something else (a weird rounding issue?)
Has anyone experienced anything similar or could point me in the direction of what I could do to resolve?
Best Answer
-
Hi @LCash
Just curious if you multiply your numerator and denominator by 1.0 to force them both to be decimals on the off chance that they were being treated as integers and doing integer division instead of decimal / float division.
(SUM(column1) * 1.0) / (COUNT(column2) * 1.0)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3
Answers
-
In your card, how do you have the field formatted? If you are leaving it as default it may be rounding it to the nearest whole number. Make sure you click the pencil icon when hovering over the field and choose Format and Display As Number and choose the appropriate decimal places.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Thanks both! I will raise a support ticket. To confirm @MarkSnodgrass decimal precision is set to 6 but still some weird rounding (or something) going on. Have tried ROUND((5/4),6) as well, same result.
The same beastmodes on a non-federated dataset work fine - and like I say other beastmodes on the federated set seem ok too, so I'm at a loss. Hopefully support can point me in the right direction.
2 -
Hi @LCash
Just curious if you multiply your numerator and denominator by 1.0 to force them both to be decimals on the off chance that they were being treated as integers and doing integer division instead of decimal / float division.
(SUM(column1) * 1.0) / (COUNT(column2) * 1.0)
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 -
@LCash I second @GrantSmith's suggestion. I've run into a similar situation in some of my SQL dataflows where the result was rounding to the nearest integer because the numerator and/or denominator were integer datatypes. Forcing both to a decimal should do the trick.
2 -
Thank you @GrantSmith and @MichelleH! That's worked.
0
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.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 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