Hi there,
I am trying to calculate the percentage of ethnic groups out of the entire population with an Arcade expression. This is what I have so far, any pointers on how to get this outputting a percentage rounded to 1 dp? Thanks! I am trying to do this in a Dashboards chart but figured there would be more Arcade support on this forum 🙂
#have connected to my portal and choosing the fields I want
var portal = Portal('https://arcgis.com');
var fs = FeatureSetByPortalItem(
portal,
'9b38b9f62ab74cb0aed6649d0f713cfa',
0,
[
'C18_Ethnicity_L1_European',
'PopCount_2018'
],
false
);
#trying to sum the value of the two fields
var european = Sum('C18_Ethnicity_L1_European')
var popcount = Sum('PopCount_2018')
#trying to calculate the percentage
var europeanperc = (european/popcount)*100
return FeatureSet(Number(europeanperc))
You may find this helpful: https://developers.arcgis.com/arcade/function-reference/text_functions/#text
This is written for Pro, but has some Arcade examples: https://pro.arcgis.com/en/pro-app/latest/help/mapping/text/specify-text-for-labels.htm