Write the results of KPI to a variable

Dears,

We have created a list of KPIs that are visualized in a world map. The user select using the buttons the KPI they are interested and the map is updated accordingly. (screen 1)

Tolerances are setup manually, using variable assignments (screen 2)

Our problem is that we want to Generate dynamic thresholds based on KPIs results.

For example, the result of the select KPI for all records is 0.513% and I would like to use this value to set it up as the upper tolerance, when user selects “Automatic Thresholds” , I tried different ways but I always get the variables place holders are writing using Text and not with the value of the KPI. (Screen 3) – Is it possible to write the results of KPI to a variable?

Thanks in advance,

Cristian