Currently i have below query, but the Active field will not give required count because if i check the count of Active on first week of last month, obviously it will show zero because i am checking today and i know some of the tickets are open on that week of the month. My question is how to calculate this?
I am finding difficulty in calculating active count.
Active should be the count of open tickets(not resolved) till that week. WE have resolved date column also
index=abc sourcetype=xyz "Assignment group"!="Assignment group" (Priority="1 - Critical" OR Priority="2 - High" OR Priority="3 - Moderate" OR Priority="4 - Low") | table Number "Assignment group" State Priority _time Updated Opened Categorization |dedup Number |search "Assignment group"!=*xyz123* AND (Categorization="Correction" OR Categorization="Incident") | eval Opened1=strptime(Opened, "%Y-%m-%d") |eval Opened2=strftime(Opened1, "%Y-%m-%d")|eval week=strftime(relative_time(Opened1,"@w5+7d"),"%Y-%m-%d") | eval week2=strftime(relative_time(Opened1,"@w5"),"%Y-%m-%d") | eval week=if(Opened2=week2, week2,week)
|stats count(eval(State!="Cancelled")) as New, count(eval(State!="Closed" AND State!="Resolved" AND State!="Cancelled")) as New2 by week | streamstats current=t sum(New2) as Active |fields - New2
| tail 20|sort week |
append [search index=abc sourcetype=xyz "Assignment group"!="Assignment group" (Priority="1 - Critical" OR Priority="2 - High" OR Priority="3 - Moderate" OR Priority="4 - Low") | table Number "Assignment group" State Priority _time Updated Opened Resolved Categorization| search Resolved=* | search State!="Cancelled"
| dedup Number| search "Assignment group"!=*xyz123* AND (Categorization="Correction" OR Categorization="Incident")| eval Resolved1=strptime(Resolved, "%Y-%m-%d") |eval Resolved2=strftime(Resolved1, "%Y-%m-%d")|eval week=strftime(relative_time(Resolved1,"@w5+7d"),"%Y-%m-%d") | eval week2=strftime(relative_time(Resolved1,"@w5"),"%Y-%m-%d") | eval week=if(Resolved2=week2, week2,week)| stats count as Closed by week | tail 20 | sort week ]
| stats first(*) as * by week
... View more