Hi!
I need help with advanced formatting a list element in my dashboard. I have a data set that contains the number of completed questionnaires per topic and the target number of questionnaires. How do i write an arcade expression to calculate the progress as a percentage for each topic (Questionnaires completed/Target) and state whether the topic is 'outstanding' (highlighted in red) or 'achieved' (highlighted in green) based on the percentage.
Thank you 🙂
Is your example table the way the data itself is organized? What's the source table look like? Assuming your table is an accurate representation, here's what it could look like:
// calculating your percentage var q_complete = $datapoint['questionnaires_completed'] var q_target = $datapoint['target'] var percentage = (q_complete / q_target) * 100 // color based on percentage; replace with whatever hex codes you like var status_color = Iif( percentage == 100, '#ddffdd', // green '#ffdddd' // red ) // returning the values return { backgroundColor: status_color, attributes: { percentage } }
Then in your list item template, reference {expression/percentage} to pull in the percentage value.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.