I am looking to set up a histogram type serial chart in a dashboard using data from one field which comes in as integers ranging from 0 to 45. For example, 5 records might read like the table below. What I am looking to do is count the values in this field grouped by a range, say 0-10; 11-20; 21-30; 31-40; 41 and above. So my final results would look something like this, 0-10 = 1; 11-20 = 2; 21-30 =1; 31-40 = 1; and 41 and up = 0.
Is this possible to do in a dashboard?
Thank you for all your help in advance.
Unfortunately, a dashboard can only group features in a chart by an attribute, as opposed to a range of values. This means your bar chart would have one bar for all the 12s, one for all the 13s, and so on, which is not what you want.
If you already know the bin size you want, an easy workaround is to create a new field, let's call it field_one_binned, and it will be a string field.
Using the field calculator, a simple when statement can populate the field. Note that I'm using Arcade here, but it would be very similar to use an SQL CASE to do the following:
var n = $feature.field1; When( n >= 0 && n <= 10, '0-10', n > 10 && n <= 20, '11-20' ... )
And so on. This hard-codes the histogram "bin" as an attribute, so it's not as dynamic as a histogram chart in something like Insights, Pro, or other non-Esri software, but a quick field calculation could easily re-assign bins.
This does pose a problem if you have a live layer that is updated with new features. If it were in an enterprise geodatabase, an attribute rule could handle the binning calculation, otherwise it would have to be some recurring script.
PS - If the stats are more important the geographic context, you might want to look into some of the incredible python libraries out there for interactive data viz. Personally, I would suggest Bokeh.
Thank you for getting back with my post. I was afraid that was the answer, I did not think it would be possible either, but thought I would reach out to the community. I think your work around might be a good option. It is however in an enterprise geodatabase where new features will be added, maybe not daily but certainly annually. Could the same logic you provided by applied to this situation or is there something different when working with data in an enterprise geodatabase.
Also, thank you for the data visualization tip! that will come in handy later down the road.
It is actually easier for you with the data in an enterprise geodatabase. Take a look at calculation attribute rules to see how to set it up, but the "bins" field you create would be able to be updated automatically.