Creating Buckets in Beast Mode
Hello!
So I'm trying to create temperature buckets in beast mode. Here's my formula:
case
when (`temperature` >= '33' and `temperature` <= '39') then '30s'
when (`temperature` >= '40' and `temperature` <= '49') then '40s'
when (`temperature` >= '50' and `temperature` <= '59') then '50s'
when (`temperature` >= '60' and `temperature` <= '69') then '60s'
when (`temperature` >= '70' and `temperature` <= '79') then '70s'
when (`temperature` >= '80' and `temperature` <= '89') then '80s'
when (`temperature` >= '90' and `temperature` <= '99') then '90s'
when (`temperature` >= '100') then '100s'
else 'Freezing'
end
When I look at the different buckets, all temperatures that are greater or equal to 100 and all temperatures below freezing are all grouped in the '100s' bucket. Is there something wrong with my equation?
Best Answers
-
Is `temperature` numeric or string?
'33' and 33 ARE NOT the same thing. '33' is a string whereas 33 is numeric.
I suspect you want
CASE when (`temperature` >= 33 and `temperature` <= 39) then '30s'
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
@jaeW_at_Onyx is correct that your temperature must be a string value and needs to be converted to numeric. You can do this very easily in Magic ETL by adding a Set Column Type tile to your ETL.
Also, you can simplify your CASE statement since CASE statements exit out of the function once it finds a matching criteria. This means you could rewrite it like this:
case when `temperature` <= 32 then 'Freezing' when `temperature` <= 39 then '30s' when `temperature` <= 49 then '40s' when `temperature` <= 59 then '50s' when `temperature` <= 69 then '60s' when `temperature` <= 79 then '70s' when `temperature` <= 89 then '80s' when `temperature` <= 99 then '90s' else '100s' end
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0
Answers
-
Is `temperature` numeric or string?
'33' and 33 ARE NOT the same thing. '33' is a string whereas 33 is numeric.
I suspect you want
CASE when (`temperature` >= 33 and `temperature` <= 39) then '30s'
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
@jaeW_at_Onyx is correct that your temperature must be a string value and needs to be converted to numeric. You can do this very easily in Magic ETL by adding a Set Column Type tile to your ETL.
Also, you can simplify your CASE statement since CASE statements exit out of the function once it finds a matching criteria. This means you could rewrite it like this:
case when `temperature` <= 32 then 'Freezing' when `temperature` <= 39 then '30s' when `temperature` <= 49 then '40s' when `temperature` <= 59 then '50s' when `temperature` <= 69 then '60s' when `temperature` <= 79 then '70s' when `temperature` <= 89 then '80s' when `temperature` <= 99 then '90s' else '100s' end
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
The values were coming in as a string but I figured it out!
Thanks for all the help!
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 660 Datasets
- 117 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 84 App Studio
- 46 Variables
- 778 Automate
- 190 Apps
- 482 APIs & Domo Developer
- 83 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 412 Distribute
- 120 Domo Everywhere
- 281 Scheduled Reports
- 11 Software Integrations
- 145 Manage
- 141 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive