Getting the Values using Kibana by using StateCode


I have a variable which is TimeTaken , and I log the value as TimeTaken:10 with StateCode 1111
and TimeTaken 20 with StateCode 2222

When I use the KQL Query, sum(TimeTaken, Kql = 'StateCode:1111'). What value do we receive?

Finally, can I retrieve the value for a variable with Different StateCode? at each statecode the value is different