× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



If you only want to group per week, you don't need to calculate the Monday's
date of a week, simply accumulate on the week according the ISO guidelines
(or the week based on January 1st is always in the first week).

Select Year(YourDate), item, Sum(Case When Week_ISO(YourDate) = 1 then
YourAccount Else 0 End) Week1,
Sum(Case When Week_ISO(YourDate) = 2 then YourAccount Else 0
End) Week2,
Sum(Case When Week_ISO(YourDate) = 3 then YourAccount Else 0 End)
Week3,
....
Sum(Case When Week_ISO(YourDate) = 53 then YourAccount Else 0
End) Week53
From YourTable
Where YourDate between .... and ....
Group By Year(YourDate), Item
Order BY Year(YourDate), Item

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Brian
Gesendet: Wednesday, 26.11 2014 21:32
An: Midrange Systems Technical Discussion
Betreff: Re: Get Start Date of a Week Number

Thank you for the feedback. In the forecast I am getting arbitrary dates
and quantities. The person getting the report simply wanted the quantities
accumulated by week. So, if I got data for Monday and Tuesday of the same
week, I would add those together.

In my report, I had a row for each item and then a column for each week.
It might look like this:

Item, Week 1, Week 2
ABC,344,200

And so on.

After generating that output, the user then asked to have the start date for
the week show instead of the week number so now it night look like:

Item, 2014-12-29, 2015-01-05
ABC,344,200

The 12/29 and 01/15 dates were just from a calendar I was looking at. I do
not think it matters at all if the definition of the week is the ISO one or
not. The main thing is that I am consistent and put dates as the column
headings and not week numbers anymore.

I think Birgitta's solution will work, but I am not in a place to try it out
at the moment.

If you've got other thoughts though, just let me know.

Thanks to all who replied so far!


On Wed, Nov 26, 2014 at 11:22 AM, John Yeung <gallium.arsenide@xxxxxxxxx>
wrote:

On Wed, Nov 26, 2014 at 9:52 AM, Brian <belstsrv@xxxxxxxxx> wrote:
I have the need to get the date of the first day of the week based
on a week number.

The date can be based off Sunday or whatever arbitrary day could be
considered as the first day of the week, if that helps.

I think you need to be more clear. Are we talking about ISO week
numbers (see John E's link)? Or do *you* choose which day of the
week? Or is that something that is given to you? Or are you given a
start date?

As an example, if I had week number of 1, the date might be
12/29/2014, week 2 would give me 1/5/2015 and so on.

Where does the 12/29/2014 come from? Is that input? Could you be
given any arbitrary date as input?

If you're not talking ISO, and you get *two* pieces of input, and
those two pieces are (1) a start date and (2) the week number, then
you can simply add the required multiple of 7 days. Taking your
example, where startDate is d'2014-12-29' and weekNumber is 2:

newDate = startDate + %days(7 * (weekNumber - 1))

But your requirements may be different. I'll wait until you clarify
before offering more.

John Y.




Can anyone provide some suggestions on a method to get to a date
based
off
the week number?

Thank you.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.