OK, what I mean is something like this....
SELECT
@select:dim:user_def:implied:RES:ROWNUM:uq_id@,
@select:dim_prop:user_def:implied:RES:NVL(status,99):status@,
@select:dim_prop:user_def:implied:RES:(case
when status = 0 then 'Populated'
when status = 1 then 'Submitted'
when status = 2 then 'Returned'
when status = 3 then 'Approved'
when status = 4 then 'Posted'
when status = 5 then 'Adjusted'
when status is null then 'Unpopulated'
else 'Unpopulated'
end):TS_STATUS_DISPLAY@,
@select:dim_prop:user_def:implied:RES:statcount:statcount@
FROM
(
SELECT status
, count(*) statcount
FROM
(
SELECT nvl(ts.prstatus,99) status
, case
when TS.PRSTATUS= 0 then 'Populated'
when TS.PRSTATUS= 1 then 'Submitted'
when TS.PRSTATUS= 2 then 'Returned'
when TS.PRSTATUS= 3 then 'Approved'
when TS.PRSTATUS= 4 then 'Posted'
when TS.PRSTATUS= 5 then 'Adjusted'
when TS.PRSTATUS is null then 'Unpopulated'
else 'Unpopulated'
end AS TS_STATUS_DISPLAY
FROM PRTIMEPERIOD TP
JOIN PRJ_RESOURCES PR ON 1=1
JOIN SRM_RESOURCES SR on ( SR.ID = PR.PRID )
LEFT JOIN PRTIMESHEET TS ON (TP.PRID=TS.PRTIMEPERIODID AND SR.ID = TS.PRRESOURCEID)
JOIN PRJ_OBS_ASSOCIATIONS poa on ( SR.ID=poa.RECORD_ID )
JOIN PRJ_OBS_UNITS pou on ( poa.unit_id= pou.id AND pou.type_id=5000002 )
WHERE PR.PRTRACKMODE=2
AND PR.prisopen = 1
AND TP.PRISOPEN=1
AND SR.is_active=1
AND SR.unique_name <> 'OUTR'
AND SR.last_name <> 'PIC'
AND (@WHERE:PARAM:USER_DEF:DATE:P_DATE@ between tp.prstart and tp.prfinish)
AND (pou.id = @WHERE:PARAM:USER_DEF:INTEGER:P_OBS_ID@)
)
GROUP BY status
)
--
WHERE @FILTER@
HAVING @HAVING_FILTER@
I took your query and rewrote it.
Points to note;
This was on ORACLE - you will need to change the NVL() to IsNull()
I have "parameterised" the date for which you are analysing data and the OBS for which you are analysing.
This will make a param_p_date and a param_p_obs appear in your query attributes. You need to associate a lookup that provides the OBS unit_id with the param_p_obs attribute.
By parameterising these fields it makes the portlet much more flexible - you can default the param_p_date to "today" in the portlet.
When creating the portlet, select the "statcount" as the metric and in the "options" select the "ts_status_display" as the label.
Add the 2 "param" fields to the filter portlet.
--
There is a LOT more you can do with this sort of information - you could add "drill-downs" to the segments in the pie-chart to list the specific resources who have not filled in timesheets etc.... but thats a different thread I think.
Hope this helps?