Hi, I've successfully utilised the following from the 'FMS' website to create a crosstab query that generates sequential monthly column totals irrespective of whether a month contains data or not.
I'd like to manipulate the query so that I can eg enter a start date of #01/10/16# and obtain total number of orders on the [OrderDate] on a DAILY basis (not monthly basis) for next 7 days whilst also including days that don't have any orders
Can't get my head round this one, suspect I may be over-complicating this - any assistance would be appreciated
I'd like to manipulate the query so that I can eg enter a start date of #01/10/16# and obtain total number of orders on the [OrderDate] on a DAILY basis (not monthly basis) for next 7 days whilst also including days that don't have any orders
Code:
"The trick is to think of each month as a unique number starting from Year 0:
[INDENT]Year([OrderDate])*12+Format([OrderDate],"mm") - (Year([StartDate])*12+Format([StartDate],"mm")) + 1
[/INDENT]The equation defines each month as a number (Years * 12 + Month) and subtracts the StartDate month from the OrderDate month plus one. The result is a month number from 1 to 12 defining the months"
Can't get my head round this one, suspect I may be over-complicating this - any assistance would be appreciated