Page 1 of 1

Week Number in Quarter

Posted: Mon Nov 10, 2008 7:31 am
by dssiddu
HI All

Please tell how to get week number for each quarter?
Each quarter have 12 weeks.
1 quarter 1-12 week in no.
2 quarter 1-12 week in no ..etc

Thanks a ton in Adv
:roll:

Posted: Mon Nov 10, 2008 7:50 am
by Mike
The easiest solution is to do a lookup against your company's calendar dimension table.

Beyond that, you'll have to define exactly what a week means to your business and create transformation rules as required:

For example:
What day starts your week?
Does week one always include 7 days?
Does the first full week of the quarter constitute week one?
Is the first day of the quarter always in week one?
etc.
etc.

Mike

Posted: Mon Nov 10, 2008 4:35 pm
by ray.wurlod
Where are you going to put weeks 49 through 53? You need to think more carefully about your business rules. How is week #1 in any year defined? Is it necessary that every week has 7 days? (It should be, if you're planning to summarize/aggregate by week.)

Posted: Mon Nov 10, 2008 10:03 pm
by dssiddu
Thanks Ray and Mike For your quick replay

Actuly In week either 7 days or 5 days, But i need to get total calendar weeks in a quarter let us say 1 to 12 for each quarter.and restart count if month jan,april,july and october.

Posted: Mon Nov 10, 2008 10:32 pm
by ray.wurlod
There are usually 13 weeks in a quarter, but it still depends on how you define "week". I can not stress how important it is to get this (business rule) right.

Posted: Tue Nov 11, 2008 1:13 am
by Saad
I agree with Mike, in most of the cases there is always a calendar table defined for business related queries. You can simply fetch the records from that table joining on the date, this way you'll not need to define the business rule again.

Regards,

Saad

Posted: Tue Nov 11, 2008 7:26 am
by ray.wurlod
Yes but you still have to build the calendar table, and you need the rules to do that.

Posted: Tue Nov 11, 2008 7:27 am
by ray.wurlod
Yes but you still have to build the calendar table, and you need the rules to do that.

Posted: Tue Nov 11, 2008 8:20 am
by Saad
Ray, you seem to second your thoughts at the moment :wink: