Group by week between date range
Hi,
i'm having a table for documents. The documents are received from diffeent dates. I've to calculate number of documents received on weekly basis.
I need an sql to count the number of documents between two given dates grouping by weekly.
My week starts on Sunday and ends with Saturday.
I've tried group by with to_char(documentdate,'IW') , but this will take Monday to Sunday as a week & the incomlete weeks i'm not able to calculate. ie : in the below output the date range 1/28/2007 - 1/31/2007 is not a complete week . ( ie saturday to wednesday)
I need out put should be like this for Date Range: 12/31/2006 to 1/31/2007
week count of documents
12/31/2006 - 1/6/2007 10
1/7/2007 - 1/13/2007 40
1/14/2007 - 1/20/2007 30
1/21/2007 - 1/27/2007 20
1/28/2007 - 1/31/2007 10
Please help me to get this.....
(columns in documents table is documentid and documentdate)
your're very close with IW. you just need to shift the data to get it to fall within the correct range. btw, you don't need julian dates. it's overkill
trunc(date+1,'IW') will push the date into the correct week range (IW will put sunday one week earlier than you want, so push it ahead a day before truncating).
then subtract 1 day from the result to get it to display with sunday's date instead of monday
trunc(mydate+1, 'IW')-1
and the week end date is simply trunc(mydate+1, 'IW')_5
select mydate, to_char(mydate,'Dy') dy,
trunc(mydate+1,'IW')-1 wk_Start,
trunc(mydate+1,'IW')+5 wk_end
from (select sysdate-rownum mydate from dual connect by level < 20)
order by 1
Similar Messages
-
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
How to count the days between Date Range using OO ABAP?
hi experts,
i want to count the days between Date Range using OO ABAP for that which class and method can i use?.
Thanks,
Mahesh.Not sure I understand the requirement for it to be OO, but you could always write your own (i.e. use this):
REPORT zz_date_diff.
CLASS date_diff DEFINITION.
PUBLIC SECTION.
METHODS diff IMPORTING i_date_fm TYPE d
i_date_to TYPE d
EXPORTING e_days TYPE i.
ENDCLASS."
CLASS date_diff IMPLEMENTATION.
METHOD diff.
e_days = i_date_to - i_date_fm.
ENDMETHOD."
ENDCLASS."
DATA: g_ref TYPE REF TO date_diff,
g_days TYPE i,
g_date_fm TYPE d VALUE '20080101',
g_date_to TYPE d VALUE '20090101'.
START-OF-SELECTION.
CREATE OBJECT g_ref.
CALL METHOD g_ref->diff
EXPORTING
i_date_fm = g_date_fm
i_date_to = g_date_to
IMPORTING
e_days = g_days.
WRITE g_days. -
Hi All,
I have transaction line data for each day for our customer and i would like to group via Week Ending date. Our week runs from Sunday to Saturday.
If i Add the transaction date to the group expert it allows me to group via week(perfect) but does it via week commencing. I see you can group via formula, does any one know how you can get the grouping via Week Ending.
thanks for any help and advise.
mikeTry using this formula...
DateAdd("ww", DateDiff("ww", #1/6/1900#, {TableName.DateField}), #1/6/1900#)
This formula will calculate the "Following Saturday" for any given date. If the date supplied is a Saturday, it will return that same date.
So...
11/2/2010 > 11/6/2010
11/13/2010 > 11/13/2010
11/14/2010 > 11/20/2010
HTH,
Jason -
Dear all,
I am very new to Sharepoint designer 2010. Its better to say, i am just stepping in.
I have sharepoint site which is accessible for all the users to update few information. But i want this site not to be accessible during a date range, say from 15th to 20th of every month.
I am planning to have something like this: If any user tries to access this sharepoint site between 15th to 20th date range of everymonth, then the browser must show an pop-up alert saying "This site is not accessible during this date range" and Redirect
this sharepoint site to someother site (Say http:// somesitename.xx.com) immidiately.
I know very little about how to add Javascript in sharepoint webpart.
Please provide the Javascript or any best alternate solution to my concern.
Thanks in advance.Hi,
From your description, my understanding is that you want to redirect sharepoint site to another site between 15th and 20th every month.
I agree with what Sudip says. If you still want to use JS code,You could try these steps
below:
Open your site with SharePoint Designer.
Click Master Pages in left navigation.
Find file v4.master, and backup it(it is very important).
Right click your v4.master,
choose "Edit File in Adavance Mode".
Add the code below into the <head/> tag.
<script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script><script
type="text/javascript">
$(document).ready(function(){
var today = new Date();
var day = today.getDate(); // get current day
var id = _spPageContextInfo.userid; // get the id of current logon in user
var boolFlg = false;
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/SiteGroups/GetByName(\'"+"sharepoint Owners"+"\')/Users", //get users in a specified group can access the sharepoint site from 15th to 20th every
month
type: "GET",
headers: {"accept": "application/json;odata=verbose"},
success: function (data) {
if (data.d.results) {
var src = data.d.results;
for(var i = 0; i < src.length; i++){
if(src[i].userid==id){ //check the logon in user in the specified group or not
boolFlg = false;
break;
if(!boolFlg){
if(day <= 20 && day >=15){
alert("This site is not accessible during this date range"); // alert the message
location.href = "http:// somesitename.xx.com"; // redirect to another site
error: function (xhr) {
alert(xhr.status + ': ' + xhr.statusText);
})</script>
Best Regards
Vincent Han
TechNet Community Support -
Using analytical function to calculate concurrency between date range
Folks,
I'm trying to use analytical functions to come up with a query that gives me the
concurrency of jobs executing between a date range.
For example:
JOB100 - started at 9AM - stopped at 11AM
JOB200 - started at 10AM - stopped at 3PM
JOB300 - started at 12PM - stopped at 2PM
The query would tell me that JOB1 ran with a concurrency of 2 because JOB1 and JOB2
were running started and finished within the same time. JOB2 ran with the concurrency
of 3 because all jobs ran within its start and stop time. The output would look like this.
JOB START STOP CONCURRENCY
=== ==== ==== =========
100 9AM 11AM 2
200 10AM 3PM 3
300 12PM 2PM 2
I've been looking at this post, and this one if very similar...
Analytic functions using window date range
Here is the sample data..
CREATE TABLE TEST_JOB
( jobid NUMBER,
created_time DATE,
start_time DATE,
stop_time DATE
insert into TEST_JOB values (100, sysdate -1, to_date('05/04/08 09:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 11:00:00','MM/DD/YY hh24:mi:ss'));
insert into TEST_JOB values (200, sysdate -1, to_date('05/04/08 10:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 13:00:00','MM/DD/YY hh24:mi:ss'));
insert into TEST_JOB values (300, sysdate -1, to_date('05/04/08 12:00:00','MM/DD/YY hh24:mi:ss'), to_date('05/04/08 14:00:00','MM/DD/YY hh24:mi:ss'));
select * from test_job;
JOBID|CREATED_TIME |START_TIME |STOP_TIME
----------|--------------|--------------|--------------
100|05/04/08 09:28|05/04/08 09:00|05/04/08 11:00
200|05/04/08 09:28|05/04/08 10:00|05/04/08 13:00
300|05/04/08 09:28|05/04/08 12:00|05/04/08 14:00
Any help with this query would be greatly appreciated.
thanks.
-peterafter some checking the model rule wasn't working exactly as expected.
I believe it's working right now. I'm posting a self-contained example for completeness sake.I use 2 functions to convert back and forth between epoch unix timestamps, so
I'll post them here as well.
Like I said I think this works okay, but any feedback is always appreciated.
-peter
CREATE OR REPLACE FUNCTION date_to_epoch(p_dateval IN DATE)
RETURN NUMBER
AS
BEGIN
return (p_dateval - to_date('01/01/1970','MM/DD/YYYY')) * (24 * 3600);
END;
CREATE OR REPLACE FUNCTION epoch_to_date (p_epochval IN NUMBER DEFAULT 0)
RETURN DATE
AS
BEGIN
return to_date('01/01/1970','MM/DD/YYYY') + (( p_epochval) / (24 * 3600));
END;
DROP TABLE TEST_MODEL3 purge;
CREATE TABLE TEST_MODEL3
( jobid NUMBER,
start_time NUMBER,
end_time NUMBER);
insert into TEST_MODEL3
VALUES (300,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 19:00','MM/DD/YYYY hh24:mi')));
insert into TEST_MODEL3
VALUES (200,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 12:00','MM/DD/YYYY hh24:mi')));
insert into TEST_MODEL3
VALUES (400,date_to_epoch(to_date('05/07/2008 10:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 14:00','MM/DD/YYYY hh24:mi')));
insert into TEST_MODEL3
VALUES (500,date_to_epoch(to_date('05/07/2008 11:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 16:00','MM/DD/YYYY hh24:mi')));
insert into TEST_MODEL3
VALUES (600,date_to_epoch(to_date('05/07/2008 15:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 22:00','MM/DD/YYYY hh24:mi')));
insert into TEST_MODEL3
VALUES (100,date_to_epoch(to_date('05/07/2008 09:00','MM/DD/YYYY hh24:mi')),
date_to_epoch(to_date('05/07/2008 23:00','MM/DD/YYYY hh24:mi')));
commit;
SELECT jobid,
epoch_to_date(start_time)start_time,
epoch_to_date(end_time)end_time,
n concurrency
FROM TEST_MODEL3
MODEL
DIMENSION BY (start_time,end_time)
MEASURES (jobid,0 n)
(n[any,any]=
count(*)[start_time<= cv(start_time),end_time>=cv(start_time)]+
count(*)[start_time > cv(start_time) and start_time <= cv(end_time), end_time >= cv(start_time)]
ORDER BY start_time;
The results look like this:
JOBID|START_TIME|END_TIME |CONCURRENCY
----------|---------------|--------------|-------------------
100|05/07/08 09:00|05/07/08 23:00| 6
200|05/07/08 09:00|05/07/08 12:00| 5
300|05/07/08 10:00|05/07/08 19:00| 6
400|05/07/08 10:00|05/07/08 14:00| 5
500|05/07/08 11:00|05/07/08 16:00| 6
600|05/07/08 15:00|05/07/08 22:00| 4 -
Hi All,
I need to findout the number of satuday's between the given date range.
Please tell me if there are any function modules or methods to calculate this.
Regards
SuprithHi Suprith,
Please refer the below Code.
CALL FUNCTION 'DAY_ATTRIBUTES_GET'
EXPORTING
* FACTORY_CALENDAR = ' '
* HOLIDAY_CALENDAR = ' '
DATE_FROM = From_Date
DATE_TO = To_Date
LANGUAGE = SY-LANGU
* NON_ISO = ' '
* IMPORTING
* YEAR_OF_VALID_FROM =
* YEAR_OF_VALID_TO =
* RETURNCODE =
TABLES
day_attributes = it_day_attri
* EXCEPTIONS
* FACTORY_CALENDAR_NOT_FOUND = 1
* HOLIDAY_CALENDAR_NOT_FOUND = 2
* DATE_HAS_INVALID_FORMAT = 3
* DATE_INCONSISTENCY = 4
* OTHERS = 5
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
in the Export internal table it_day_attri you will get all the dates and its respective days. if you delete the records other than Saturday , the number of entries will be needed count of saturday.
delete it_day_attri where WEEKDAY <> '6'.
DESCRIBE TABLE it_day_attri LINES Count.
note : weekday day number ( Saturday = 6 may vary based on factory calendar )
Edited by: Prasath Arivazhagan on Apr 8, 2010 1:07 PM -
i'm having data stored as follows
DEPOT_CODE EMP_ID ACTIVE_FROM ACTIVE_TO
400 68955 01-JAN-08 31-JAN-09
400 68962 01-JAN-08 20-JAN-08
400 68999 01-JAN-08
400 689600 01-JAN-08
400 684530 01-JAN-08
I wanted to list all the records active in between given date range even though active_to is null
i.e if i give 10/01/2008 to 02/02/2008
i want to display all the records which is shown in above
Thanking youLakmal, I wouldn't take advise from Bhaskar on this one, as he clearly does
not know how to work with dates, and also does not grasp the concept of a
date range.
You have a range, and you want to check if it covers (in whole or in part)
the from-to period, right?
I changed the data to include a row (first one) not to be output.
with dummy as (
select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from,
to_date('05-JAN-08', 'DD-MON-YY') active_to from dual union all
select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from,
null active_to from dual union all
select 400 depot_code, 68955 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from,
to_date('31-JAN-09', 'DD-MON-YY') active_to from dual union all
select 400 depot_code, 68962 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from,
to_date('20-JAN-08', 'DD-MON-YY') active_to from dual union all
select 400 depot_code, 68999 emp_id, to_date('01-JAN-08', 'DD-MON-YY') active_from,
null active_to from dual
select *
from dummy
DEPOT_CODE EMP_ID ACTIVE_FR ACTIVE_TO
400 68955 01-JAN-08 05-JAN-08
400 68955 01-JAN-08
400 68955 01-JAN-08 31-JAN-09
400 68962 01-JAN-08 20-JAN-08
400 68999 01-JAN-08
5 rows selected.
SELECT *
FROM dummy
WHERE NVL (active_to, TO_DATE ('10-JAN-08', 'DD-MON-YY')) >=
TO_DATE ('10-JAN-08', 'DD-MON-YY')
AND active_from <= to_date('02-FEB-08', 'DD-MON-YY')
DEPOT_CODE EMP_ID ACTIVE_FR ACTIVE_TO
400 68955 01-JAN-08
400 68955 01-JAN-08 31-JAN-09
400 68962 01-JAN-08 20-JAN-08
400 68999 01-JAN-08
4 rows selected.given that active_from is never null.
Isn't it as simple as this? The active_to must be after your start_date,
and the active_from must be before the end.... -
Parameter prompts- Displaying task details between date range
Hi all,
I have created a report ( Crystal reports 2008) which lists task related details( distinct count) by region, customer and work type. I created two parameters to let the users specify the date ranges. Based on the user inputs, the title of the report would be " there are -- tasks between the user specified date ranges//-- and -//". I am not sure how to go about displaying the title in the format specified.
It would be great if you guys could give me your suggestions on this.
Thanks a lot,
Vinne
Edited by: Vinnie_uic on Jun 8, 2010 9:32 AMHi, I don't have 2008, but this should still work.
You can add your text as shown.
" there are tasks between the user specified date ranges and "
Add your parameters to the report, also add a counter for your tasks.
then you just drag and drop those into the title.
When you edit the title it "May" look like this.
"There are {@Count_of_Tasks} tasks between the user specified date ranges {?Start_date} and {?End_Date} "
but it should display as
"There are 15 tasks between the user specified date ranges 5/20/2010 and 5/17/2010 "
If that does not work for you, use the & sign, and create your formula like this.
There are &" "& {@Count_of_Tasks}&" "& tasks between the user specified date ranges &" "&{?Start_date} and&" "& {?End_Date}
I hope the formatting is correct for 2008 -
Data between Date Range with Business Days only
Hi All,
We have a requirement that we need to retrieve data between a data range, providing From date and To date as input.
We also have the option to Include Business Days Only through a check box which will be passed to CR 2008 through a report frame work.
Can some one help me how to display the report data within the Date Range entered and that includes only Business Days.
Thanks in advance for the help.
Regards,
Naresh.try this formula. Lets if your date range parameter is {?date} then try this formula
@startdate:
if datepart('w',minimum({?date}))=7 then
minimum({?date})+2
else if datepart('w',minimum({?date}))=1 then
minimum({?date})+1
else
minimum({?date})
@enddate
if datepart('w',maximum({?date}))=7 then
maximum({?date})+2
else if datepart('w',maximum({?date}))=1 then
maximum({?date})+1
else
maximum({?date})
regards,
Raghavendra -
Grouping by month within date range
Hi,
I have a date range which I like to group by months, but not from the 1st to last date of the calendar month but by given start date. For example the table below represents the date range with some values in a table. So the
first month range in the group should be from 06/06/2013 to 08/07/2013. The 06/07/2013 is absent because it's Saturday. In fact the data is populated with working days only.
Table below shows what I really would like to get:
There is a simple calculation for each month anniversary date, if the value from the start date, 06/06/2013, here 12 is less than the next month anniversary date, 08/07/2013, which is 9, then it should ignore it. And only show the value from the month
who's anniversary date value is less than the first date value, 12. So the example above shows value 14 for the second month's anniversary date, 06/08/2013. If the value has been found in any month the show, and ignore the rest.
I am just interested if there are any and report which number of month and the value.
I can implement this in procedural way, such as in VBA, but because the above looped many times it will take hours to run the process. I have tried in SQL Server, but first problem I came up with is that I can't group by month from the given start
date.
Is this possible to do in T-SQL ?I'm not sure I entirely understand your question. So I'll break the answer into two parts.
First, as I understand it, you are looking for a way to group data by months, but not all dates in June, 2013 as one group, all dates in July, 2013 as the next group, etc. Instead you want all dates from June 6, 2013 to July 5, 2013 as the first month,
all dates from July 6, 2013 to August 5 as the second month etc. The way to do that is use
DATEDIFF(month, '20130606', <your date column>) + CASE WHEN DAY(<your date column>) < 6 THEN -1 ELSE 0 END
So you can assign the month number you want to every row when you select from your table by
SELECT DATE, VALUE, DATEDIFF(month, '20130606', DATE) + CASE WHEN DAY(DATE) < 6 THEN -1 ELSE 0 END AS MonthNumber
FROM <your table name>
Now as I understand it (but am not sure), you want the first value in each "month" (as you are defining "month" which is greater than the value contained in your start date and if no value in a particular month is greater than that value,
you don't want any row for that month. For that you could do something like
Declare @StartDate date;
Declare @StartValue int;
Set @StartDate = '20130606';
Select @StartValue = Value From <your table name>
Where Date = @StartDate;
;With cteMonthNumber As
(SELECT DATE, VALUE, DATEDIFF(month, @StartDate, DATE) + CASE WHEN DAY(DATE) < DAY(@StartDate) THEN -1 ELSE 0 END AS MonthNumber
FROM <your table name>
WHERE DATE > @Date AND VALUE > @Value),
cteOrdered As
(Select DATE, VALUE, MonthNumber,
ROW_NUMBER() OVER (PARTITION BY MonthNumber ORDER BY DATE) As rn
From cteMonthNumber)
Select MonthNumber, Value As KickOutValue
From cteOrdered
Where rn = 1;
Tom
P.S. Notice that I wrote my date literal as YYYYMMDD. This is a good idea in SQL Server since '20130806" will always be interpreted as August 6. But depending on the settings on your server and/or client '06/08/2013' might be dd/mm/yyyy
and so be August 6, but it might be interpreted as mm/dd/yyyy and be June 8.
It is also a good idea to express date literals in this forum as yyyymmdd. There are a lot of us on the forum from the United States and we think 06/08/2013 is June 6 and a lot of us from other places who think 06/08/2013 is Aug 8. If you give
your dates as yyyymmdd we don't have to try to figure out what format you are using. -
Display all dates between date range (Time Dimension left outer join Fact)
All,
I have done some searching around this issue but within all the posts regarding date variables, date prompts and date filtering I haven't seen one exactly answering my issue (maybe they are and I just dont have my head around it correctly yet).
My report requirement is to allow a user to select a start day and an end day. The report should show all activity between those two days - AND display 0/null on days where there is no activity. That second part is where I am getting hung up.
The tables in question are:
TimeDim
EventFact
CustomerDim
My BMM is setup as follows:
TimeDim left outer join EventFact
CustomerDim inner join EventFact
If I run a report selecting DAY from TimeDim and a measure1 from EventFact with day range 1/1/2010 - 12/31/2010 .. I get a record for every day and it looks perfect because of the left outer join between TimeDim and CustomerDim.
But .. if I add in a field from CustomerDim, select TimeDim.DAY, CustomerDim.CUSTNAME, EventFact.MEASURE1, OBIEE only returns records for the days that have EventFact records.
This is due to the fact that the TimeDim is still outer joined into EventFact but adding in CustomerDim makes OBIEE setup an inner join between those tables which then causes only data to be returned where EventFact data exists.
There is a way around this in this simple case and that is to define the relationship between CustomerDim and EventFact as an outer join as well. This will give the desired effect (but an outer join between these two tables is not the true relationship) and as I add additional dimensions and add additional logical sources to a single dimension in the BMM it gets complicated and messy.
Ive also messed with setting the driving table in the relationship, etc.. but it has not given the desired effect.
Has anyone ever encountered the need to force display all dates within a specfied range with a fact table that may not have an entry for every date?
Thanks in advance.
K
Edited by: user_K on Apr 27, 2010 11:32 AMIt worked!!!* Even my time drill downs and date based filtering still work!
That is awesome. Never would have thought of that intuitively.
Now, just need a little help understanding how it works. When I run my report and check the logs I can see that two queries are issued:
Query 1: Joins the fact table to all the associated dimensions. I even changed all the relationships to inner joins (which is what they truly are). And calculates the original measure. If I copy and paste this query into sql developer it runs fine but only returns those rows that joined to the time dimension - which is what was happening before. It is correct but I wanted a record for every time dimension record.
Query 2: Looks like the following:
select sum(0)
from timedim
where date between <dateprompt1> and <dateprompt2>
group by month *<--* this is the time dimension level specified in Query 1, so it knows to aggregate to the month level as was done in query 1
Final Question: So what is OBIEE doing ultimately, does it issue these two requests and then perform a full outer join or something to bring them together? I couldn't see anywhere in the log a complete query that I could just run to see a similar result that I was getting in Answers.
Thanks for all the help .. Id give more points if I could.
K -
Grouping by week using Date column
I have a table with a date column. I'd like to generate a report grouping all entries by week. Is this possible with the date expressions/functions within Oracle?
ThanksWhat is your definition of a week?
select to_char(sysdate, 'IW') from dual
will return 21 which is the week of the year according to the ISO standard
So a query such as
SELECT TO_CHAR(mydate, 'IW'), col1, col2
FROM mytable
GROUP BY TO_CHAR(mydate, 'IW')
will group the data by the ISO week.
You may also want to select the year as part of the query.
null -
Export Mail to pst between date range with Messagekind eq Email
Exchange 14.2 247.5
I am trying to export all mail from a piped list of mailboxes but only between two dates. I can do one or the other, but not combine both contentfilters - can anyone offer any advice as to what I'm doing wrong? I've played with different combinations of
brackets but I can't get it do do an -and for some reason. My spreadsheet has columns for alias and pstpath - this part is fine, I just can't get it to evaulate both contentfilters. My short script:
foreach ($i in (Import-Csv c:\temp\export\mailtest.csv)) {
New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {(Received -lt '07/18/2014') -and (Received -gt '06/18/2014')} {MessageKind -eq Email}
I'm also running a script to shift all calendars and contacts (not date limited) to pst but am running this seperately. If these can be combined then great, but I'm happy to run two commands.
THanks
James.No joy still with that either. Running Get-MailboxExportRequestStatistics -Identity MaibloxName\MailboxExport
-IncludeReport | Format-List gives the error message:
AssociatedMessagesCopyOption : DoNotCopy
BatchName :
ContentFilter : ((((Received -lt '18/07/2014 12:00:00 AM') -and (Received -gt '18/06/2014 12:00:00 AM')
)) -and (MessageKind -eq 'Email'))
ContentFilterLanguage :
BadItemLimit : 0
BadItemsEncountered : 0
QueuedTimestamp : 19/07/2014 3:18:11 PM
StartTimestamp :
LastUpdateTimestamp : 19/07/2014 3:18:15 PM
CompletionTimestamp :
SuspendedTimestamp :
OverallDuration : 00:00:15
TotalSuspendedDuration :
TotalFailedDuration : 00:00:12
TotalQueuedDuration : 00:00:03
TotalInProgressDuration : 00:00:00
TotalStalledDueToHADuration :
TotalTransientFailureDuration :
MRSServerName :
EstimatedTransferSize : 0 B (0 bytes)
EstimatedTransferItemCount : 0
BytesTransferred : 0 B (0 bytes)
BytesTransferredPerMinute :
ItemsTransferred : 0
PercentComplete : 0
PositionInQueue :
FailureCode : -2146233088
FailureType : InvalidContentFilterPermanentException
FailureSide :
Message : Error: ContentFilter is invalid. The value "18/07/2014 12:00:00 AM" could not be conver
ted to type System.DateTime. --> The value "18/07/2014 12:00:00 AM" could not be conver
ted to type System.DateTime.
FailureTimestamp : 19/07/2014 3:18:15 PM
FailureContext :
I am in AU using English (australia) and so using dd/mm/yyyy short date format but understand that this is irrelevant and we use mm/dd/yyyy for powershell operations.
The command I am using is:
New-MailboxExportRequest -Mailbox $i.Alias -FilePath $i.PSTpath -ContentFilter {((Received -lt '07/18/2014') -and (Received -gt '06/18/2014') -and (MessageKind -eq "Email"))}
I don't understand why this is failing... -
Generating Dates Between Date Range
Hi,
I have a table with test_id, a_id, start_date, end_date like the below.
test_id a_id start_date end_Date
861 2123 05-Dec-2009 10-Dec-2009
861 2124 06-Dec-2009 09-Dec-2009
864 2123 08-Dec-2009 10-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009
I need to generate dates between the start_date and end_date like the below. Kindly help.
test_id a_id start_date end_Date tdate
861 2123 05-Dec-2009 10-Dec-2009 05-Dec-2009
861 2123 05-Dec-2009 10-Dec-2009 06-Dec-2009
861 2123 05-Dec-2009 10-Dec-2009 07-Dec-2009
861 2123 05-Dec-2009 10-Dec-2009 08-Dec-2009
861 2123 05-Dec-2009 10-Dec-2009 09-Dec-2009
861 2123 05-Dec-2009 10-Dec-2009 10-Dec-2009
861 2124 06-Dec-2009 09-Dec-2009 06-Dec-2009
861 2124 06-Dec-2009 09-Dec-2009 07-Dec-2009
861 2124 06-Dec-2009 09-Dec-2009 08-Dec-2009
861 2124 06-Dec-2009 09-Dec-2009 09-Dec-2009
864 2123 08-Dec-2009 10-Dec-2009 08-Dec-2009
864 2123 08-Dec-2009 10-Dec-2009 09-Dec-2009
864 2123 08-Dec-2009 10-Dec-2009 10-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009 07-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009 08-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009 09-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009 10-Dec-2009
864 2124 07-Dec-2009 11-Dec-2009 11-Dec-2009
Please reply at the earliest. Its very urgent. Thanks in advance.
Regards,
Gayathri Deviwith t
as
select 861 test_id, 2123 a_id, to_date('05-Dec-2009','dd-mon-yyyy') start_date, to_date('10-Dec-2009','dd-mon-yyyy') end_date from dual union all
select 861, 2124, to_date('06-Dec-2009','dd-mon-yyyy'), to_date('09-Dec-2009','dd-mon-yyyy') from dual union all
select 864, 2123, to_date('08-Dec-2009','dd-mon-yyyy'), to_date('10-Dec-2009','dd-mon-yyyy') from dual union all
select 864, 2124, to_date('07-Dec-2009','dd-mon-yyyy'), to_date('11-Dec-2009','dd-mon-yyyy') from dual
select test_id, a_id, start_date, end_date, start_date+no-1 dt
from t
cross join
select level no
from dual
connect by level <= (select max(end_date-start_date+1) from t)
where case when start_date+no-1 > end_date then null else start_date+no-1 end is not null
order by 1,2,5
Maybe you are looking for
-
Fonts jagged in InDesign and PDF export
I've been troubleshooting this issue for days, with no success. I'm using IDCS6 on a MacBook Pro with Mountain Lion, and it probably happens with all fonts, but I've noticed it specifically with "Din mittelschrift" at a large pt. size and 100% magnif
-
Itunes update will not install
itunes does not update. It says a new version is available. Iselect "download new version" but it does not download
-
Some basic questions: Help defining Real World Classes
I am trying to write a small applet using proper OO concempts and Java technique and I'm confused on the proper way to do this. I think I know several ways that work and have all the peices I need such as JMail and JDBC drivers, but would appreciate
-
Hi all, I have a fact table with a lot of production checks. The checks are all dimension tables with value 0 (rejected) and 1 (pass). For the moment I'm only interested in the rejects. FactProduction: Factkey, LineNrKey, DateKey, Check1Key, Check2Ke
-
New Inkjet Printer Recommendations?
My little trusty HP 932c (from the stone age) has finally given up the ghost. I'm interested in getting something in the $200ish range to replace it, though I would consider going higher if features would warrant the additional cost. I've only just s