Project Portal, MSP_Portfolio_Analyzer, date dimension faulty week number
Hi,
I am working on a MDX query on the MSP_Portfolio_Analyzer cube of Project and I have problem that the date dimension contain wrong week number. For instance if I browse the dimension to 2013, quarter 3, month September it says day 1 is on Week 36. When I
use datepart function to return week number for 2013-09-01 I receive week 35 which is supposed to be correct.
The format on one date from dimension is:
[Time].[Time].[Year].&[2013].&[3].&[9].&[36].&[2013-09-01T00:00:00]
The MDX query I am building is going to show forcast for capacity and worked hours, but I have problem when the week number is off compared with week number retrieved from now(). Any suggestion on how to solve this?
[Time].[Time].[Year].&[2013].&[3].&[9].&[36].&[2013-09-01T00:00:00]
Hello,
This might help:
http://blogs.msdn.com/b/brismith/archive/2010/02/26/addressing-iso-8601-week-numbering-in-project-server-2007-and-2010.aspx
Paul
Paul Mather | Twitter |
http://pwmather.wordpress.com | CPS
Similar Messages
-
TO_CHAR with dates to get week number issue
I am trying to build a report showing weekly sales data and running into an issue with Dates and TO_CHAR..
Using the date 9/29/2007, I expect the return from the following to be 4:
SELECT TO_CHAR('09/29/2007','W') FROM DUAL
However, it returns 5!!! Testing further I tried the next day, since it is a Sunday, it should be the start of the next week, 5..
SELECT TO_CHAR('09/30/2007','W') FROM DUAL.. I do get a 5..
I understand that the implementation of TO_CHAR with the 'W' parameter defaults a week start on what ever the first day of the month is, but I need a method that is more calendar like (Sunday is the start of a week, Saturday end of the week).
Anyone have a nifty solution?
Thank you,
Tony Miller
UTMB/EHNThis works pretty well. Please note that it is zero based, so add 1 if you want it to start with the first week as 1.
WITH TAB AS
(SELECT TO_DATE('12/01/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/02/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/03/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/04/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/05/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/06/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/07/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/08/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/09/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/29/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/30/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL UNION ALL
SELECT TO_DATE('12/31/2007', 'mm/dd/yyyy') DATE_COL FROM DUAL)
SELECT DATE_COL,
TO_CHAR(DATE_COL, 'ww') W_IN_YEAR,
TO_CHAR(TRUNC(DATE_COL, 'month'), 'ww') W1_OF_MONTH,
TO_NUMBER(TO_CHAR(DATE_COL, 'ww')) -
TO_NUMBER(TO_CHAR(TRUNC(DATE_COL, 'month'), 'ww')) MY_WEEK,
TO_CHAR(DATE_COL, 'W') ORACLE_WEEK
FROM TAB
DATE_COL W_IN_YEAR W1_OF_MONTH MY_WEEK ORACLE_WEEK
01-DEC-2007 48 48 0 1
02-DEC-2007 48 48 0 1
03-DEC-2007 49 48 1 1
04-DEC-2007 49 48 1 1
05-DEC-2007 49 48 1 1
06-DEC-2007 49 48 1 1
07-DEC-2007 49 48 1 1
08-DEC-2007 49 48 1 2
09-DEC-2007 49 48 1 2
29-DEC-2007 52 48 4 5
30-DEC-2007 52 48 4 5
31-DEC-2007 53 48 5 5
12 rows selected -
How to get the week start date from ISO week number
Hi,
I have a table with the following stucture
Year error Week1 week2 week3 ......week53
2012 error1 2 4 2 1
2012 error2 3 0 1 1I was hoping to get something like select year, error, week1||'Week start date which is a monday of that week' , week2||'Week start date,again monday',....week53 from table
Any suggestions please?
Thanks,
SunHi, Sun,
To see when week N started, add 7 * (N - 1) days to the beginning of the year. (By definition, the beginning of the ISO year is the start of week 1 of the ISO year.)
To see when week 22 of the current year started:
SELECT TRUNC (SYSDATE, 'IYYY') + (7 * (22 - 1))
FROM dual
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
Display ISO week number instead of date on x axis in Bar Chart
Hi,
I've created a simple SSRS report based on bar chart that shows several milestones. Everything works fine for me except I’m not able to convert the date into ISO week number format.
I played around with different approaches. I was able to convert the date into an ISO week Format directly on the SQL Server. That
wasn't a problem.
But unfortunately I’m not able to display the week number on the horizontal axis in my Bar Chart. I tried both fields: TaskFinishDate and TaskFinishDateMS...
I would like to show the ISO week number instead of the date within the Bar Chart on the horizontal axis.
Any ideas/hints/help is really appreciated!
Thanks,
MikeHi Mike,
Per my understanding that you want to get the week number of the year based on the field "TaskFinishDate" which is datetime type and display the week number in the x-axis instead of the field "TaskFinishDate", right?
I have check the snapshot you have provided and it seems you have change the format of the datetime field in the x-axis like "dd.MM.YYYY", If you can't make the week number to display correctly in the x-axis, the issue can be caused by you haven't
change the format to Number in the category.
Details information below for you reference:
I assume you have use expression in the Label like below to convert the datatime TaskFinishDate in to ISO week number like below:
=DatePart(DateInterval.WeekOfYear,Fields!TaskFinishDate.Value)
or
=DatePart("ww",Fields!TaskFinishDate.Value)
Right click the X-axis and select the "Horizontal Axis Properties", then click the Number to change the format to "Number" as below:
Preview you will get the weeknumber display in the x-axis correctly.
If you still have any problem, please feel to ask.
Regards,
Vicky Liu
If you have any feedback on our support, please click
here.
Vicky Liu
TechNet Community Support -
Return date for a given week number in a month
Hi,
Can someone urgently post a snippet code that will return the date if the week number and the weekday (like wednesday) for a given month in an year is passed.
ex: If I say 2nd wednesday of August in 2004 , it must return the date for second wednesday. URGENTDon't flag your question as urgent, even if it is for you. Claiming urgency is very likely to be counter-productive: most forum regulars will simply ignore such messages as rude and selfish attempts to elicit immediate and special attention.
Besides, unless the Symbionese Liberation Army is about to chase you over the edge of a cliff, your problem probably isn't as urgent as you think. :o) -
How to convert a date value into week value?
How to display the date value like '20010203'
into the week number of the year 2001?
When i type in the following sql
select week(chg_time) from site;
I got this error message
ORA-00904: invalid column nameuse the to_char function, to format the date into a week number (then you might need to convert that to a number using to_number)
select to_char( sysdate, 'WW') from dual`
a description of datetime formats: http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a90125/sql_elements4.htm#48515 -
Get week number for day from a list of days within a year..
I am beginning in ORACLE / SQL and wondering how I can use this query to work with a column of Dates that span over a number of years?
Ideally, I would like to use this script to add a number for the week of the year based on this.
Then when a new year begins to start over..
I am referencing an old thread..
TO_CHAR with dates to get week number issue
Here is what I have so far:
I keep getting an error stating "Bind Variable "p_date_beg" is NOT DECLARED"..
Thanks in advance for any help you can provide.
DECLARE
p_date_beg DATE;
BEGIN
SELECT RETRIEVAL_DATE
INTO P_DATE_BEG
FROM OBS_SELECT_LST12_SPG;
WITH TAB AS
(SELECT TO_DATE(TO_CHAR(:p_date_beg,'YYYYMM')||'01','YYYYMMDD') + LEVEL -1 DATE_COL
FROM DUAL
CONNECT BY LEVEL <=TO_NUMBER(TO_CHAR(LAST_DAY(:p_date_beg),'DD')))
SELECT DATE_COL, TO_CHAR(DATE_COL, 'FMDAY') DAY,
(CASE
WHEN TO_CHAR(TRUNC(DATE_COL, 'mm'),'FMDAY') = 'SUNDAY'
THEN TO_NUMBER(TO_CHAR(DATE_COL,'W'))
ELSE CEIL((TO_CHAR(SYSDATE, 'dd') + 1 - TO_CHAR(NEXT_DAY(TRUNC(SYSDATE, 'mm'), 'SUNDAY'), 'dd'))/7)
END) WEEK_NOB
END;hi, referring to this link about ISO week, http://www.epochconverter.com/date-and-time/weeknumbers-by-year.php, here is the code:
/* Formatted on 2012/06/13 06:32 (Formatter Plus v4.8.8) */
WITH t AS
(SELECT MIN (TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1)
start_date,
1 week_th
FROM DUAL
WHERE TO_CHAR ( TRUNC (TO_DATE ('20120101', 'rrrrmmdd'), 'mm')
+ LEVEL
- 1,
'FMDAY'
) = 'MONDAY'
AND ( TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1 <
TRUNC (NEXT_DAY (TO_DATE ('20120101', 'rrrrmmdd'),
'THU'
OR (TO_DATE ('20120101', 'rrrrmmdd') + LEVEL - 1
BETWEEN TRUNC (NEXT_DAY (TO_DATE ('20120101',
'rrrrmmdd'
'THU'
AND TRUNC (NEXT_DAY (TO_DATE ('20120101',
'rrrrmmdd'
'THU'
+ 7
CONNECT BY LEVEL < 15),
v AS
(SELECT t.start_date + 7 * (LEVEL - 1) start_date,
t.week_th + LEVEL - 1 week_th
FROM t
CONNECT BY LEVEL < 53),
u AS
(SELECT '20120501' dt
FROM DUAL
UNION ALL
SELECT '20120502'
FROM DUAL
UNION ALL
SELECT '20120503'
FROM DUAL
UNION ALL
SELECT '20120504'
FROM DUAL
UNION ALL
SELECT '20120505'
FROM DUAL
UNION ALL
SELECT '20120506'
FROM DUAL
UNION ALL
SELECT '20120507'
FROM DUAL
UNION ALL
SELECT '20120508'
FROM DUAL
UNION ALL
SELECT '20120509'
FROM DUAL)
SELECT *
FROM u, v
WHERE TO_DATE (u.dt, 'rrrrmmdd') BETWEEN v.start_date AND (v.start_date + 6);output:
DT START_DATE WEEK_TH
20120501 30/04/2012 18
20120502 30/04/2012 18
20120503 30/04/2012 18
20120504 30/04/2012 18
20120505 30/04/2012 18
20120506 30/04/2012 18
20120507 07/05/2012 19
20120508 07/05/2012 19
20120509 07/05/2012 19 -
How to get day from Week Number
Hi all,
how to get date from the week number when the day is MONDAY.
like : week num =33
how get the date of the day MONDAY from this..SQL> select
to_char(d,'YYYY') y,
w,
trunc((trunc(d,'Y')+w*7-date '1000-01-01')/7)*7+date '1000-01-01' monday
from
(select sysdate d, 33 w from dual);
Y W MONDAY
2005 33 15.08.2005Message was edited by:
Laurent Schneider
I wrote an article which may help you to get out of the mess with weeks that start on friday, saturday, sunday, monday
http://laurentschneider.blogspot.com/2005/07/tochar-d.html -
Dreamweaver MX extracting week number
My form collects a date (which the user picks from a pop-up
calendar). That date is submitted to a field (datBegin) in the
MySQL database. Fine.
In the process of submitting that date, I want a portion of
it (the "week-number" represented by the date that the user
entered) to be submitted to another field (week_nbr) in the same
MySQL database and table.
In other words, the user enters the date once. When he clicks
submit, the date (like 2007-5-17) is placed in the datBegin field,
and the week number (like 20) should be placed in the week_nbr
field.
The formating of the week number is not a problem. It is done
with DATE_FORMAT(datBegin,'%u'). But the submitting of it to the
database is what I am not able to accomplish. The date and the week
number are of course part of the same record (row).
If anyone can help, I'd greatly appreciate it. (I have run
out of things to try!) Most of my attempts have been to create a
value for week_nbr in a hidden field. I have also tried the
DATE_FORMAT in Recordsets. None of this has been succesful in
getting a week_nbr value (based on the just entered datBegin)
stored to the MySQL database.
I use PHP and work with Dreamweaver MX.Hi David Powers,
Thanks for your input regarding the week number problem.
re.
> The way to do it is to use
DATE_FORMAT(datBegin,'%u') as part of your query. For
example:
SELECT thisCol, thatCol, DATE_FORMAT(datBegin,'%u') as
week_num
FROM mytable
ORDER BY week_num DESC
This is exactly what I have tried over and over again, many
times. This
approach fails when you add the WHERE statement:
WHERE kalendar.week_nbr = servicegrupp.vecka
However, when I hard code the week_nbr into the kalendar
table, then the
WHERE statement works as intended. There is a match, in other
words.
It appears that the reason it does not work unless the
week_nbr is in the
table, is that "week_num" (as you have it) from the query is
not a field but
something else, perhaps a variable. I'm not sure about the
terminology. To
match output from the table with output from an AS statement
in the query
does not work -- at least not in my experience.
I guess the scenario is one of relations. In other words the
"week_nbr"
from the kalendar table relates to the "vecka" in the
servicegrupp table.
When both are present in their respective tables, the match
occurs.
To try to match them at the output stage, using the AS
statement in the
query, does not work. The wrong "week_nbr" is inserted --
always the number
from the top record in the table, it appears.
I know that in the case of relational tables, it is possible
to output the
id from one table to the foreign key in the related table. It
is this
facility I need to find, somehow, even though I am not
dealing with the ids.
These are my reasonings at the moment. But there is probably
a better, more
elegant way to accomplish the needed match.
Thanks again for your willingness to help.
Curt L. Gustafsson
----- Original Message -----
From: [email protected]
To: [email protected]
Sent: Thursday, May 31, 2007 7:31 PM
Subject: Dreamweaver Support subscription update.
Newsgroup User has posted a message entitled Re: Dreamweaver
MX extracting
week number.
Message Posted on: Thursday May 31,2007 10:31:12 AM
curtgus wrote:
> In the process of submitting that date, I want a portion
of it (the
> "week-number" represented by the date that the user
entered) to be
submitted to
> another field (week_nbr) in the same MySQL database and
table.
You don't need to. The information stored in datBegin already
contains
that information, as you point out yourself.
> The formating of the week number is not a problem. It is
done with
> DATE_FORMAT(datBegin,'%u').
You're approaching the problem the wrong way. You presumably
want to
store the week number so that you can search according to
week number or
display results by week number. The way to do it is to use
DATE_FORMAT(datBegin,'%u') as part of your query. For
example:
SELECT thisCol, thatCol, DATE_FORMAT(datBegin,'%u') as
week_num
FROM mytable
ORDER BY week_num DESC
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
You can view the message at
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=189&threadid=1272474&fo rumid=12. -
How to format a date to display the ISO week number in BI Publisher ?
Hi there,
I need to format a date to display the ISO week number in BI Publisher.
I've tried the following <?format-date:NEED_BY_DATE;'WW'?>, but it returns a week number (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year, which is not what I want.
I want the ISO week number (1-52 or 1-53), the one implemented by the 'IW' format mask of the Oracle PL/SQL TO_CHAR() function for example.
I've tried using 'IW' format mask, but it is not recognised by BI Publisher.
Also, as I'm working on an RTF template, I've tried 'IW' as MS Word date format, but it is not recognised by MS Word :-((
Any help would be much appreciated,
Regards - HuguesHi,
Thank you for the post.
The thing is I don't have access to the query, unless I modify a standard E-Businees Suite view (one of those used to generate the PO document in Purchasing).
Regards - Hugues -
How to get the week number of year from a Date object?
Hi!
I would like to know the week number of the year from a specified Date.
I dont know how to set the first day of week, and set the minimum days of a week.
I want to use Monday for first day of week, and at least 4 days of month in a week.
For example if its 1st, January is Friday, then the first week starts on 4th, Monday.
Anyone can help?Sorry. I should think before I move.
public static int getWeekOfYear(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setMinimalDaysInFirstWeek(4);
return calendar.get(Calendar.WEEK_OF_YEAR);
} -
XSLT Mapping: how to calculate Week number of the year from given date
Hi,
I have input as date, i need to know the Week number from that date in XSLT Coding.
for Eg: if date is 29-12-2009 it should give 53rd week of the year.
All answers will be appreciated.
Regards,
MayankHi add this statement to your XSLT Mappping
<xsl:stylesheet version="1.0" xmlns:java="http://xml.apache.org/xslt/java" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="java">
and use <xsl:template name="GetDateInLocal" xmlns:cal="xalan://java.util.GregorianCalendar"> in XSLT Mapping , write your logic.
cheers,
Raj -
How do I look for a date that corresponds to a particular Week Number in a table?
Hello,
I have a table (Table A) that looks like this (I am only including the first 5 months to keep image size down):
The numbers in the table are dates, with custom formatting to just show the day.
I have another table with all of the Week Numbers for a given year in the first column and a second column in which I would like a formula to count the numbers of dates in Table A that correspond to the Week Number in the first column (i.e. the number of dates that falls within that week).
The following statement works for testing single cells:
=COUNTIF(WEEKNUM(Table A :: $Session 1 $January,2),A1)
But it would seem that I can only use this with single cells and not the table as a whole.
Could someone help with a solution to this?
Thanks,
NickThanks Jerry. If I have understood you correctly I would need to calculate the week numbers of the dates in Table A in Table A itself, like this:
Then I would use the COUNTIF function to test the array of week numbers in Table A. If this is correct, I am not sure how to construct an array that includes just the cells with week numbers. I presume I could do this either manually or based on the value in the first column of Table A (i.e. just testing the five columns to the right of each "Week No" row), but I'm not sure.
Nick -
How to calculate start date of the week based on week number ?
i need to get week number of the current date and based on that i need to calculate start date falling in the same week for last year.
Eg. today is 31st week of year and 31st july date. so what will be the date on the 31st week of last year. i need the start date of that week.
we can calculate the week number by select to_char(sysdate,'ww') from dual.
DO we have a single line query for that or will it require writing a pl/sql block ?you can try following query
it can be as inline but for more clean look and create it as select with include select
with t as
(select sysdate as dt from dual)
select to_char(prev_year_dt - to_char(prev_year_dt, 'D') + 1, 'DD.MM.YYYY') as start_of_week from (select
-- get day from prev year with the same week number
case
when to_number(to_char(add_months(dt, -12), 'WW')) > to_number(to_char(dt, 'WW')) then
dt - (to_number(to_char(add_months(dt, -12), 'WW')) - to_number(to_char(dt, 'WW'))) * 7
when to_number(to_char(add_months(dt, -12), 'WW')) < to_number(to_char(dt, 'WW')) then
dt + (to_number(to_char(dt, 'WW')) - to_number(to_char(add_months(dt, -12), 'WW'))) * 7
else
add_months(dt, -12)
end as prev_year_dt
from t) t1good luck
Sergii
'Monday' is not first day of week in 100% ;)
Edited by: Galbarad on Jul 30, 2012 11:00 PM -
Get week ending date from Year and Week Number
I would like to display the week ending date in a Report.
My dataset query has grouped the results by year and week number, so I am trying to construct the week ending date from year and week number.Week end date can be got as below
=DateAdd(DateInterval.WeekOfYear,CInt(Fields!WeekNumber.Value) -1,DateAdd(DateInterval.Year,(Cint(Fields!Year.Value) - 1900),CInt("12/31/1899")))
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Maybe you are looking for
-
Bug: when fetching arrays of rows with null data values
Using Oracle ODBC Driver 8.01.73.00 or 8.01.74.00 (called 8.1.7.3.0 and 8.1.7.4.0 on the Oracle downloads page). When fetching multiple rows, and where some of the data is null, the the indicator variable quite often (but not always) has incorrect va
-
Dear All, I am under a process of installing 9.2.0.8 on 9.2.0.6 ORACLE_HOME, i have started the process a few mins ago, suddenly an error came its says : Problem in saving Inventory. Installation cannot continue /ebiz/oracle/oraInventory/ContentsXML/
-
How do u merge documents into one?
how do u merge documents into one?
-
Help design a lightweight FVWM-based desktop
I'm looking to design a new desktop for both of my current machines. Why FVWM you may ask? Well, I'm not sure, I just like FVWM and the way you can customize things. But, I need ideas for the interface. I need this to work well on my desktop (2560x16
-
Source of the stuttering playback in CC 2014
I'm trying to playback a series of 4K tiff images and it's probably only playing about 1/4 of the frames, if that. I know that's a tough ask of any computer, but when I saw how the hardware was working I thought I'd check I haven't done anything wron