hi,
i have value(sales amount) for business days only ie., working days
Instead of date i want to display business days(1,2,3,4…)
Ex:
Date Amt
01/10/2005 20
04/10/2005 10
05/10/2005 5
07/10/2005 15
It’s a combination of three other variables I found somewhere on these boards (can’t seem to find the original anymore) but it basically counts the number of weekends in the date range and subtracts those days back out of the total. One of my developers has since taken this formula and rewritten it into a dimension of the universe to hide the complexity of the formula.
Obviously [Submitted Date], [Date Approved], and [Production Date] are the Dimensions from the query.
This post may also help you out.
Or try searching for NETWORKDAYS (the Excel function that accomplishes this) or Business Days on the forum and you’ll find some other ideas.
It’s actually important to note on this formula (as I should have previously) that we had to use an If statement because we didn’t have a submitted date for every record from a data migration. Therefore, we had to use the If(IsNull… portion to determine which date to calculate from.
Just wanted to clear up any confusion that may come from that.
You haven’t mentioned what database server you use so I can just point out an option but no code.
Presumption:
It will work if your business weeks are in line with the calendar weeks.
Coding:
Generate the week of the year (check whether you need to do this in ISO8601 or whether database function is ok for users), multiply by 5 (assuming 5 business days per week).
Add to this number the day of the week - depending on which time locale you are you have to either leave it as is (Monday as starting day) or subtract 1 from it (if Sunday is the starting day of the week).
If you just want to display business days from the lowest starting date then deduct the minimum week of the date from your week calculation.
This function doesn’t take bank holidays into account. If you require this functionality then a calendar lookup table is what you have to build.