The data resides in a single table. I have a totals query (qryYTDFullCommissionTotal) to calculate the year-to-date total of the FullCommission field by Year and Month.
SELECT Format([RevenueDate],"yyyy") AS Yr, Format([RevenueDate],"mmm") AS Mo, Format(DSum("FullCommission","Revenue","DatePart('m', [RevenueDate])<=" & [MoNN] & " And DatePart('yyyy', [RevenueDate])=" & [Yr] & " AND [SaleStatusID] <> 3"),"#,##0") AS YTDFullCommission, Format([RevenueDate],"mm") AS MoNN
FROM Revenue
GROUP BY Format([RevenueDate],"yyyy"), Format([RevenueDate],"mmm"), Format([RevenueDate],"mm")
ORDER BY Format([RevenueDate],"yyyy"), Format([RevenueDate],"mm");
I have a crosstab query (qryYTDFullCommissionXTab) which uses the totals query to report YTD amounts with months across the top and years down the side.
TRANSFORM Sum([qryYTDFullCommissionTotal].YTDFullCommission) AS SumOfYTDFullCommission
SELECT [qryYTDFullCommissionTotal].Yr
FROM qryYTDFullCommissionTotal
GROUP BY [qryYTDFullCommissionTotal].Yr
PIVOT [qryYTDFullCommissionTotal].Mo In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
For months without a revenue record, null is shown as the year-to-date value in the crosstab query. Is it possible to calculate the year-to-date value for those months which show as null?