Joined: 14 Dec 2011
Online Status: Offline
Posts: 1
Topic: Dynamic Date columns Posted: 14 Dec 2011 at 4:37am
I have an orders table that lists (among other things) item numbers, amount ordered and order due date. I need a report that lists all the remaining days of the current(except weekends) and what is due on which day. For example, if today is the 14th, I need a report with columns starting at 14, going through the end of the month (31) that excludes weekends. (excluding weekends is not a must but a really nice to have). I need the report to list each item on the order table and populate the number due for that item on the day of the month that it is due. I am not sure where to get started on this. Any help at all would be great. My boss just dropped this on me and he wants it done yesterday.
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 14 Dec 2011 at 7:57am
if you have an order for each day of the month you can handle this by using a Crosstab as the report design. Columns set to use the date set to per day.
USe the select exopert to limit what records you pull
table.date in currentdate to dateserial(year(currentdate),month(currentdate)+1,1-1) and not(weekday(table.date) in [1,7])
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 14 Dec 2011 at 8:30am
if you don't have an order on each day, you want to use a 'complete' list of dates (from a table would be the simplest ... we have a dates table with something like 20 years of dates and what day they are) and then join to your sales orders using an outer join, so that you keep the dates that have no orders.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum