I have the following SQL that I want to display in a report with totals grouped by year, quarter, month and week.
select case statecode when '0' then 'Qualified' when '1' then 'Open' when '2' then 'Disqualified' end as 'Status',
datepart(year, createddate) as 'year', datepart(quarter, createddate) as 'quarter',
datename(month, createddate) as 'month',
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1 as 'week',
count(*) as 'enqtotal'
from bo_main
group by datepart(year, createddate), datepart(quarter, createddate), datename(month, createddate),
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1,
statecode
order by datepart(year, createddate), datepart(quarter, createddate), datename(month, createddate),
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1,
statecode
I have added a matrix to my report, and then added column groups for year (=Fields!year.Value), quarter (=Fields!quarter.Value), month (=Fields!month.Value) and week (=Fields!week.Value). Then I have a row under these columns showing =Fields!Status.Value to the left and =Fields!enqtotal.Value underneath the column groups.
I now need to add a row with the total of each enqtotal for each year/quarter/month/week combination. But upon right clicking my =Fields!enqtotal.Value cell, there is no option to add a subtotal.
This is my first report matrix, so could somebody tell me what I am doing wrong? If you need further explanation than please let me know.
Many thanks!
select case statecode when '0' then 'Qualified' when '1' then 'Open' when '2' then 'Disqualified' end as 'Status',
datepart(year, createddate) as 'year', datepart(quarter, createddate) as 'quarter',
datename(month, createddate) as 'month',
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1 as 'week',
count(*) as 'enqtotal'
from bo_main
group by datepart(year, createddate), datepart(quarter, createddate), datename(month, createddate),
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1,
statecode
order by datepart(year, createddate), datepart(quarter, createddate), datename(month, createddate),
DATEPART(week, createddate) - DATEPART(week, DATEADD(month, DATEDIFF(month, 0, createddate), 0)) +1,
statecode
I have added a matrix to my report, and then added column groups for year (=Fields!year.Value), quarter (=Fields!quarter.Value), month (=Fields!month.Value) and week (=Fields!week.Value). Then I have a row under these columns showing =Fields!Status.Value to the left and =Fields!enqtotal.Value underneath the column groups.
I now need to add a row with the total of each enqtotal for each year/quarter/month/week combination. But upon right clicking my =Fields!enqtotal.Value cell, there is no option to add a subtotal.
This is my first report matrix, so could somebody tell me what I am doing wrong? If you need further explanation than please let me know.
Many thanks!