Week Number in Quarter

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

Week Number in Quarter

Post 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:
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Saad
Participant
Posts: 16
Joined: Fri Nov 04, 2005 11:50 pm
Location: Islamabad

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes but you still have to build the calendar table, and you need the rules to do that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes but you still have to build the calendar table, and you need the rules to do that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Saad
Participant
Posts: 16
Joined: Fri Nov 04, 2005 11:50 pm
Location: Islamabad

Post by Saad »

Ray, you seem to second your thoughts at the moment :wink:
Post Reply