Frequency Chart / Histogram
Hello,
I have a range of Velocities (ft/s) and I am trying to show how many jobs we have performed within this range of velocities.
I need to remove the decimal places and would like to round the numbers up. Is there a function to do that in beast mode or ETL?
Then I would like to create a card that shows number of jobs between 0-10, 10-20, 30-40 etc to the highest value of 368.7. In the histogram chart I can't seem to define the bin ranges, is there a work around?
Thanks
Best Answers
-
Hi @user000253
In beast modes you can use the ROUND function to round a number to a specified number of decimal places.
ROUND(`number`, 0)
In this case 4.1 would go to 4 and 4.6 -> 5
If you want 4.1 -> 5 then you can use the CEILING function instead which returns the next highest whole number. (For reference FLOOR is the opposite and will drop any trailing decimals)
CEILING(`number`)
With the histogram you're not able to define the bin values, it does that for you automatically.
If you're wanting to do custom binning you can do a bar chart and define your bin value as a beast mode:
CASE WHEN CEILING(`number`) <= 10 THEN '0-10' WHEN CEILING(`number`) <= 20 THEN ’10-20' WHEN CEILING(`number`) <= 30 THEN ’20-30' WHEN CEILING(`number`) <= 40 THEN ’30-40' WHEN CEILING(`number`) <= 50 THEN ’40-50' WHEN CEILING(`number`) <= 60 THEN ’50-60' WHEN CEILING(`number`) <= 70 THEN ’60-70' WHEN CEILING(`number`) <= 80 THEN ’70-80' WHEN CEILING(`number`) <= 90 THEN ’80-90' ... WHEN CEILING(`number`) <= 340 THEN ‘330-340' WHEN CEILING(`number`) <= 350 THEN ‘340-350' ELSE ‘350+’ END
(You'll need to write the ... section. Copy and paste is your friend)
You can then place that beast mode as your x axis and count your numbers to get the number in each bin.
The beast mode works because it's exiting out after it finds the first condition that's true. So while 5 is less than 10 and 20 and all the other numbers it only returning 0-10 since that's the first condition that's true.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
@user000253 To handle the sorting, create a second beast mode with the exact same logic, but replace your when statement with numerical values. Drag this new beast mode into the sorting area and make sure aggregation is off and it is sorting ascending.
**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 -
Hi @user000253
You'll need to define your custom sorting order as the bins are now being treated as strings and "30" comes after "280"'
CASE WHEN CEILING(`number`) <= 10 THEN 1 WHEN CEILING(`number`) <= 20 THEN 2 WHEN CEILING(`number`) <= 30 THEN 3 WHEN CEILING(`number`) <= 40 THEN 4 WHEN CEILING(`number`) <= 50 THEN 5 WHEN CEILING(`number`) <= 60 THEN 6 WHEN CEILING(`number`) <= 70 THEN 7 WHEN CEILING(`number`) <= 80 THEN 8 WHEN CEILING(`number`) <= 90 THEN 9 ... WHEN CEILING(`number`) <= 340 THEN 34 WHEN CEILING(`number`) <= 350 THEN 35 ELSE ‘350+’ END
Alternatively you can utilize a simpler formula and math to get a sort order since you want a bucket size of 10:
FLOOR(CEILING(`number`) / 10)
Then put this value into your sorting on your card.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Answers
-
Hi @user000253
In beast modes you can use the ROUND function to round a number to a specified number of decimal places.
ROUND(`number`, 0)
In this case 4.1 would go to 4 and 4.6 -> 5
If you want 4.1 -> 5 then you can use the CEILING function instead which returns the next highest whole number. (For reference FLOOR is the opposite and will drop any trailing decimals)
CEILING(`number`)
With the histogram you're not able to define the bin values, it does that for you automatically.
If you're wanting to do custom binning you can do a bar chart and define your bin value as a beast mode:
CASE WHEN CEILING(`number`) <= 10 THEN '0-10' WHEN CEILING(`number`) <= 20 THEN ’10-20' WHEN CEILING(`number`) <= 30 THEN ’20-30' WHEN CEILING(`number`) <= 40 THEN ’30-40' WHEN CEILING(`number`) <= 50 THEN ’40-50' WHEN CEILING(`number`) <= 60 THEN ’50-60' WHEN CEILING(`number`) <= 70 THEN ’60-70' WHEN CEILING(`number`) <= 80 THEN ’70-80' WHEN CEILING(`number`) <= 90 THEN ’80-90' ... WHEN CEILING(`number`) <= 340 THEN ‘330-340' WHEN CEILING(`number`) <= 350 THEN ‘340-350' ELSE ‘350+’ END
(You'll need to write the ... section. Copy and paste is your friend)
You can then place that beast mode as your x axis and count your numbers to get the number in each bin.
The beast mode works because it's exiting out after it finds the first condition that's true. So while 5 is less than 10 and 20 and all the other numbers it only returning 0-10 since that's the first condition that's true.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
Hi @GrantSmith thank you very much. I have managed to do the custom bins in beast mode. The only thing now is I can't get the sorting fixed. It's taking 100-110 group etc before 20-30. Any ideas on how to fix this?
Thanks, your help is much appreciated.
0 -
Hi @GrantSmith thank you very much. I have managed to do the custom bins in beast mode. The only thing now is I can't get the sorting fixed. It's taking 100-110 group etc before 20-30. Any ideas on how to fix this?
Thanks, your help is much appreciated.
0 -
@user000253 To handle the sorting, create a second beast mode with the exact same logic, but replace your when statement with numerical values. Drag this new beast mode into the sorting area and make sure aggregation is off and it is sorting ascending.
**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 -
Hi @user000253
You'll need to define your custom sorting order as the bins are now being treated as strings and "30" comes after "280"'
CASE WHEN CEILING(`number`) <= 10 THEN 1 WHEN CEILING(`number`) <= 20 THEN 2 WHEN CEILING(`number`) <= 30 THEN 3 WHEN CEILING(`number`) <= 40 THEN 4 WHEN CEILING(`number`) <= 50 THEN 5 WHEN CEILING(`number`) <= 60 THEN 6 WHEN CEILING(`number`) <= 70 THEN 7 WHEN CEILING(`number`) <= 80 THEN 8 WHEN CEILING(`number`) <= 90 THEN 9 ... WHEN CEILING(`number`) <= 340 THEN 34 WHEN CEILING(`number`) <= 350 THEN 35 ELSE ‘350+’ END
Alternatively you can utilize a simpler formula and math to get a sort order since you want a bucket size of 10:
FLOOR(CEILING(`number`) / 10)
Then put this value into your sorting on your card.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 617 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 58 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
- 395 Distribute
- 113 Domo Everywhere
- 276 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