How to analyze Event frame reasons (store result in PI-Tag)?

Hello,

 

I'm analyzing "planned" and "not planned" downtime in PI System explorer.

 

For that I'm tracking very our event's (event frames) of downtime and manually set a "reason code" via. PI vision. Works fine.

 

Now I would like to analyze how much time of the last XX days I had a specific "reason code (planned/ unplanned downtime)" and would like to have this given back as a PI tag.

Generally I would do such an operation in the Element analysis with all it's options... but with event frames I have no link to it.

 

I'm looking for days for an solution or a hint, but can't find anything...

 

Would be very thankful for support.