
Hallo,
um aussagekräftige Statistiken zu generieren, setzen wir Excel/ODBC mit Pivottabellen ein.
Hier mal ein SQL-Statement (MySQL), dass wir so ähnlich als Grundlage für alle Statistiken benutzen. Über das Ergebnis lässt sich eine entsprechende Pivottabelle generieren, die auch Ticketeingang nach Stunden rausschmeißt.
Gruß
Daniel
SELECT
DATE_FORMAT(th.create_time, '%Y-%m') as month
, WEEK(th.create_time, 3) as cw
, DATE(th.create_time) as dateFull
, DATE_FORMAT(th.`create_time`,'%H') as hour
, th.create_time as timestamp
, th.ticket_id
, if(ht.name = 'StateUpdate','AgentClose', ht.name) as event
, q.name as queue
, u.login as agent
FROM ticket_history th
INNER JOIN ticket_history_type ht ON ht.id = th.history_type_id
INNER JOIN queue q on q.id = th.queue_id
INNER JOIN users u ON u.id = th.create_by
WHERE
DATE(th.create_time) = CURRENT_DATE -- heute
-- DATE(th.create_time) = SUBDATE(CURRENT_DATE, INTERVAL 1 DAY) -- yesterday
-- DATE_FORMAT(th.create_time, '%Y-%m') = DATE_FORMAT(CURRENT_DATE, '%Y-%m') -- this month
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3)
and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */ -- current week
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3)-1
and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */-- last week
-- th.create_time BETWEEN '2010-07-31' AND '2010-08-31' -- time span
AND (
ht.id in (
1, -- NewTicket
12, -- EmailCustomer
6, 7 -- Forward, Bounce
, 8 -- send answer
, 13 -- PhoneCallAgent
, 14 -- PhoneCallCustomer
-- , 15 -- AddNote
, 16 -- Move
)
or (ht.id = 27 and th.state_id in (2,3)) -- AgentClose
)
-----Ursprüngliche Nachricht-----
Message: 1
Date: Mon, 4 Feb 2013 11:43:47 +0100
From: Grüning, Mario

Wow - vielen Dank dafür!
Gruß, Matthias
-----Ursprüngliche Nachricht-----
Von: otrs-de-bounces@otrs.org [mailto:otrs-de-bounces@otrs.org] Im Auftrag von Obee, Daniel
Gesendet: Montag, 4. Februar 2013 13:48
An: otrs-de@otrs.org
Betreff: Re: [otrs-de] Statistik generieren
Hallo,
um aussagekräftige Statistiken zu generieren, setzen wir Excel/ODBC mit Pivottabellen ein.
Hier mal ein SQL-Statement (MySQL), dass wir so ähnlich als Grundlage für alle Statistiken benutzen. Über das Ergebnis lässt sich eine entsprechende Pivottabelle generieren, die auch Ticketeingang nach Stunden rausschmeißt.
Gruß
Daniel
SELECT
DATE_FORMAT(th.create_time, '%Y-%m') as month , WEEK(th.create_time, 3) as cw , DATE(th.create_time) as dateFull , DATE_FORMAT(th.`create_time`,'%H') as hour , th.create_time as timestamp , th.ticket_id , if(ht.name = 'StateUpdate','AgentClose', ht.name) as event , q.name as queue , u.login as agent
FROM ticket_history th
INNER JOIN ticket_history_type ht ON ht.id = th.history_type_id INNER JOIN queue q on q.id = th.queue_id INNER JOIN users u ON u.id = th.create_by WHERE
DATE(th.create_time) = CURRENT_DATE -- heute
-- DATE(th.create_time) = SUBDATE(CURRENT_DATE, INTERVAL 1 DAY) -- yesterday
-- DATE_FORMAT(th.create_time, '%Y-%m') = DATE_FORMAT(CURRENT_DATE, '%Y-%m') -- this month
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3) and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */ -- current week
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3)-1 and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */-- last week
-- th.create_time BETWEEN '2010-07-31' AND '2010-08-31' -- time span
AND (
ht.id in (
1, -- NewTicket
12, -- EmailCustomer
6, 7 -- Forward, Bounce
, 8 -- send answer
, 13 -- PhoneCallAgent
, 14 -- PhoneCallCustomer
-- , 15 -- AddNote
, 16 -- Move
)
or (ht.id = 27 and th.state_id in (2,3)) -- AgentClose
)
-----Ursprüngliche Nachricht-----
Message: 1
Date: Mon, 4 Feb 2013 11:43:47 +0100
From: Grüning, Mario

Hallo! Nur ganz kurz. Ich wollte dieses Jahr damit anfangen, Auswertungen mittels Pentaho zu generieren. Vielleicht hilft das ja bei der Frage. http://www.pentaho.de/ mfg Andreas Finke Am 04.02.2013 13:47, schrieb Obee, Daniel:
Hallo,
um aussagekräftige Statistiken zu generieren, setzen wir Excel/ODBC mit Pivottabellen ein.
Hier mal ein SQL-Statement (MySQL), dass wir so ähnlich als Grundlage für alle Statistiken benutzen. Über das Ergebnis lässt sich eine entsprechende Pivottabelle generieren, die auch Ticketeingang nach Stunden rausschmeißt.
Gruß Daniel
SELECT DATE_FORMAT(th.create_time, '%Y-%m') as month , WEEK(th.create_time, 3) as cw , DATE(th.create_time) as dateFull , DATE_FORMAT(th.`create_time`,'%H') as hour , th.create_time as timestamp , th.ticket_id , if(ht.name = 'StateUpdate','AgentClose', ht.name) as event , q.name as queue , u.login as agent
FROM ticket_history th INNER JOIN ticket_history_type ht ON ht.id = th.history_type_id INNER JOIN queue q on q.id = th.queue_id INNER JOIN users u ON u.id = th.create_by WHERE
DATE(th.create_time) = CURRENT_DATE -- heute -- DATE(th.create_time) = SUBDATE(CURRENT_DATE, INTERVAL 1 DAY) -- yesterday -- DATE_FORMAT(th.create_time, '%Y-%m') = DATE_FORMAT(CURRENT_DATE, '%Y-%m') -- this month /* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3) and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */ -- current week /* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3)-1 and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */-- last week -- th.create_time BETWEEN '2010-07-31' AND '2010-08-31' -- time span
AND ( ht.id in ( 1, -- NewTicket 12, -- EmailCustomer 6, 7 -- Forward, Bounce , 8 -- send answer , 13 -- PhoneCallAgent , 14 -- PhoneCallCustomer -- , 15 -- AddNote , 16 -- Move ) or (ht.id = 27 and th.state_id in (2,3)) -- AgentClose )
-----Ursprüngliche Nachricht-----
Message: 1 Date: Mon, 4 Feb 2013 11:43:47 +0100 From: Grüning, Mario
Subject: [otrs-de] Statistik generieren To: "otrs-de@otrs.org" Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hallo Gemeinde,
hat jemand ein Vorschlag oder ein Beispiel wie ich eine Statistik generieren kann, welche mir Anzeigt zu welcher Tageszeit wie viele Tickets erstellt werden? Für einen Zeitraum von einem Monat zum Beispiel?
Mit freundlichem Gruß Mario Grüning
--------------------------------------------------------------------- OTRS mailing list: otrs-de - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs-de To unsubscribe: http://lists.otrs.org/mailman/listinfo/otrs-de
-- www.dropwort.de

Hallo Daniel,
das hört sich sehr interessant an! Werd ich probieren, danke erst mal!
Mit freundlichem Gruß
Mario Grüning
-----Ursprüngliche Nachricht-----
Von: otrs-de-bounces@otrs.org [mailto:otrs-de-bounces@otrs.org] Im Auftrag von Obee, Daniel
Gesendet: Montag, 4. Februar 2013 13:48
An: otrs-de@otrs.org
Betreff: Re: [otrs-de] Statistik generieren
Hallo,
um aussagekräftige Statistiken zu generieren, setzen wir Excel/ODBC mit Pivottabellen ein.
Hier mal ein SQL-Statement (MySQL), dass wir so ähnlich als Grundlage für alle Statistiken benutzen. Über das Ergebnis lässt sich eine entsprechende Pivottabelle generieren, die auch Ticketeingang nach Stunden rausschmeißt.
Gruß
Daniel
SELECT
DATE_FORMAT(th.create_time, '%Y-%m') as month , WEEK(th.create_time, 3) as cw , DATE(th.create_time) as dateFull , DATE_FORMAT(th.`create_time`,'%H') as hour , th.create_time as timestamp , th.ticket_id , if(ht.name = 'StateUpdate','AgentClose', ht.name) as event , q.name as queue , u.login as agent
FROM ticket_history th
INNER JOIN ticket_history_type ht ON ht.id = th.history_type_id INNER JOIN queue q on q.id = th.queue_id INNER JOIN users u ON u.id = th.create_by WHERE
DATE(th.create_time) = CURRENT_DATE -- heute
-- DATE(th.create_time) = SUBDATE(CURRENT_DATE, INTERVAL 1 DAY) -- yesterday
-- DATE_FORMAT(th.create_time, '%Y-%m') = DATE_FORMAT(CURRENT_DATE, '%Y-%m') -- this month
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3) and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */ -- current week
/* (WEEK(th.create_time,3) = WEEK(CURRENT_DATE,3)-1 and YEAR(th.create_time) = YEAR(CURRENT_DATE)) */-- last week
-- th.create_time BETWEEN '2010-07-31' AND '2010-08-31' -- time span
AND (
ht.id in (
1, -- NewTicket
12, -- EmailCustomer
6, 7 -- Forward, Bounce
, 8 -- send answer
, 13 -- PhoneCallAgent
, 14 -- PhoneCallCustomer
-- , 15 -- AddNote
, 16 -- Move
)
or (ht.id = 27 and th.state_id in (2,3)) -- AgentClose
)
-----Ursprüngliche Nachricht-----
Message: 1
Date: Mon, 4 Feb 2013 11:43:47 +0100
From: Grüning, Mario
participants (4)
-
Andreas Finke
-
Grüning, Mario
-
Matthias Schojohann
-
Obee, Daniel