APEX 4.2.2
Say I have a resultset with 3 columns: customer name, date and number of orders. What is the quickest and most flexible way to put this data on an APEX report such that the customers go down the Y-axis and Date goes across and each cell in the report is the number of orders. Sort of like a sparse matrix, or pivot report. Also, the aggregation level of the date should be modifable at run-time i.e. each column represents a week or a month or day with the column heading changing accordingly.
e.g. for a monthly summary,
with metrics as (
SELECT
trunc(dt,'mm') dt,
nm,
count(*)
FROM data
group by nm,trunc(dt,'mm')
)
select
nm,
max(decode(....)) c1,
max(decode(...)) c2,
...
from metrics
but I am not sure how to go about doing the max(decode(...)) to show a rolling N months of data. Similarly for weekly and daily view.
Help? Thanks