AnsweredAssumed Answered

Update indicator reference value based on filter

Question asked by bpits on Sep 30, 2020
Latest reply on Oct 2, 2020 by bpits

Is it possible to make the reference value in an indicator dynamic based on other filters in the dashboard?


Use case: I'm building a crime statistics dashboard that reports, among other things, total crimes and crime rate per 1,000 residents. It works great for reporting citywide crime rates because I can hard code the city population into the indicator using Arcade while keeping the count of crimes dynamic depending on what filters are applied.


For example, if I filter by a year and get 7,520 crimes, the crime rate indicator will list 94 (7,520 * 1,000 / 80,401). The last value in that expression is the citywide population.


However, one of my filters allows the user to filter the crimes by city neighborhood (using a neighborhood name attribute on the crimes dataset). The problem is that each neighborhood has a different population. So if I filter by a neighborhood with a population of 1,354, and the number of crime in that neighborhood is 357, I want to display a crime rate of 264 (357 * 1,000 / 1,354). Instead my indicator shows a crime rate of 4 because it's still using the original citywide population of 80,401.


Okay, that was a lot of numbers, but I'm hoping it made sense. Long story short, can I use Arcade in the Indicator to put in an If or When that uses the name of the neighborhood that's been filtered to determine what population value to pass as the reference value?