MAXIMO can be finicky when it comes to SQL statements – not all SQL DATE functions work in MAXIMO.
Here are a couple of changes to your statements that have worked for me in the past…
For your Where clause change “…>getdate()-30)” to “…>(CURRENT DATE – 30 DAYS)”
where (status='CLOSE' or status='CRAFTCOMP') and (worktype='PM' or worktype='CM') and supervisor='WPOELMA' and (actfinish>(CURRENT DATE- 30 DAYS)) and (woclass='workorder') and istask=0 and siteid='WWTP'
For your select statement use “timestampdiff” (I changed your ACTSTART to REPORTDATE – as that is what you mentioned in your writing… (You may need to tweak the numbers used to divide by to get to the right value [i.e days or hours, etc…]
select avg(1.0*((timestampdiff(4, char(timestamp(actfinish)-timestamp(reportdate))))/60)/24) from workorder
Let me know if this solves the issues you are having…