Hi John Jairo Sierra Garcia,
When you are referring to "state" - can you tell us specifically what field you are referring to?
Since we dont track how long a certain field has a certain value within the product, typically to do something like this, you would need to look at the activity history and look at when that field was updated to a certain value on the ticket, and then when it was updated again to a different value, and then calculate the timing difference.
Let us know what field you are looking for specifically.
Thanks,
Jon I.