Calculate the difference between the subtotals
I'm working on a simple report that looks like this:EmployeeID EmployeeName Date salary wages
1234 Tom June 1, 2009 $2000.00
2345 harry $2400,00 June 1, 2009
3456 sally $3000.00 June 4, 2009
Partial total salary: $7400,00
Advances of salary Date EmployeeID EmployeeName
2345 harry $1000.00 may 15, 2009
3456 sally $750.00 may 15, 2009
Advances subtotal: $1750,00
Total: $5650,00
Is there any function in Discoverer, which calculates the difference between subtotals and the poster as a total. Please advise if you can create a named for this sum calculation?
Published by: user1049091 on August 6, 2009 11:33
Published by: user1049091 on August 6, 2009 12:38
Hello
Not really possible. You the best approach is probably to create a named calculation that contains the difference: for example
Decode (salary_type, 'Pay', 'Progress', - wages)
Then create a total on this calculation. You can often hide the calculation itself in terms of formatting and white text on white background.
Rod West
Tags: Business Intelligence
Similar Questions
-
How to calculate the difference between 2 dates, but with interruptions and stops between
Hello
How can I calculate the difference in minutes between 2 dates but taking into account the existence of a table in the Appendix, so if between start_date and end_date arguments, there is no 'work time' then this part of the time will not be included in the total difference.
Records of the time table example:
Time_configuration start_hour end_day end_hour 2 19:00 3 07:00 3 19:00 4 07:00 so for example first record said that on Monday you start at 19:00 and leave the next day at 7:00 and then save the same sort of thing.
There is an event that I want to track how many minutes lasted. for example, this event began the day 2 at 19:00 and ended the day 3 at 21:00
Theoretically, this event really lasted: 840 minutes. This 840 minutes are within the limits of the annex.
Thanks in advance.
The storage of the dates not as data type DATE in most cases is bad design. In addition, how do you know what day of the date is 2 at 19:00? East - Monday 2 November 2015 or Monday, March 7, 2016? It is the same for the event. In any case, assuming that both calendar and events don't extend over several weeks:
According to schedule)
Select time_configuration 2, 19:00 ' start_hour, end_day 3,' 07:00 ' end_hour of all the double union
Select 3, 19:00 ', 4,' 07:00 ' double
),
event like)
Select event_id 1, time_configuration 2, 19:00 ' start_hour, end_day 3: 21:00 ' end_hour of the double
)
Select e.event_id,
Sum)
less (e.end_day + to_date (e.end_hour, 'HH24'), s.end_day + to_date (s.end_hour, 'hh24:mi')).
greater (e.start_day + to_date (e.start_hour, 'HH24'), s.start_day + to_date (s.start_hour,'hh24:mi'))))
) * 24 * 60 minutes
Appendix s,
e event
where e.start_day + to_date(e.start_hour,'hh24:mi')< s.end_day="" +="">
and e.end_day + to_date(e.end_hour,'hh24:mi') > s.start_day + to_date(s.start_hour,'hh24:mi')
E.event_id group
/EVENT_ID MINUTES
---------- ----------
1 840SQL >
SY.
-
. For example, I need to calculate the difference between a date column, 'Table_Name '. "' Column_Name ' and (Current_Date-1). I tried different ways to do this. But nothing seems to work.
Try the below formula.
Replace "Time". "" Date "with your column.
TIMESTAMPDIFF (SQL_TSI_DAY, "Time". "Date", TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE))
Thank you!
-
Need help to calculate the difference between times
Hi all
I have two fields that stores just the hour in 24-hour ex: 08:00 and 20:00 now I want to calculate the difference between two times
Kindle help me
Thanks for your help
Thank you
RaviHello
diiference in hours
SQL> WITH T AS (SELECT '08:00' ST_TIME, '20:00' END_TIME FROM DUAL) 2 SELECT (TO_DATE (END_TIME, 'HH24:MI') - TO_DATE (ST_TIME, 'HH24:MI')) * 24 DIFF_HOURS 3 FROM T; DIFF_HOURS ---------- 12 SQL>
G.
-
FormCalc - how to calculate the difference between the two fields datetime in hh: mm?
Hello!
I am building a form of time sheet in which I need to calculate the difference between the start and end times and present the result.
I'm trying to do with FormCalc but if it is easier with JS is ok too.
So that's what I did on the total field, by using the calculate on a NUMERIC field called decimalValue event:
elapsed = Time2Num (endTime.formattedValue, "HH: mm")-Time2Num (startTime.formattedValue, "HH: mm")
And then I tried to convert a time field:
Total = decimalValue.rawValue;
$.formattedValue = Num2Time (total, "HH: mm")
Well, it doesn't work, it gives me crazy results in the datetime (total) field. If I type 09:00 and 09:30, the final result is... 22:30. Huh?
Please, could someone help me understand how this thing works?
Thanks a lot for the tips!
Marcos
Hi Marcos,
Here are some examples:
https://Acrobat.com/#d=kCPIgVkd09qrx6h-WRXxbQ
https://Acrobat.com/#d=EsWqBMBt3sgEXnMSsK5pRA
Hope that helps,
Niall
-
Calculate the difference in days between two Dates
Hello
I'm trying to understand how to calculate the difference in days between two dates using JavaScript in LiveCycle. (Minimum = JavaScript knowledge)
Where 'Start_Date' and 'Current_Date' are the names of the two dates in the palette of the hierarchy. (the two Date/time field)
* Current date is using the object > value > execution property > current Date/time
I need a text or number field showing the difference in days. (Difference_in_Days)
I noticed the following code is pretty standard among other responses:
var
Start_date = new Date (Start_Date);
var
Current_Date = new Date (Current_Date);
var
nAgeMilliseconds = Current_Date.getTime) - Start_date.getTime ();
var
nMilliSecondsPerYear = 365 * 24 * 60 * 60 * 1000 ;
I know there is lack of code and code above are may not be not correct.
Please notify.
OK, that's because of the way that javascript and works of the calculate event. The field will be filled with whatever the script resolves at the end of execution. Technically, your script does not have a value because the last thing you do is an assignment to a variable. Change the last line as follows:
Math.ABS ((firstDate.getTime)
((- secondDate.getTime (()) / (oneDay));
(eliminate the variable assignment) and get rid of the app.alert. Your script will "return" (have) regardless of the value of calculation from the East and which will be stored in the field.
-
How to calculate the difference between two times by the NUMBERS
I'm so bothered by the fact that I can't understand that.
Cell B2 - 08:00
Cell C2 - 10:50
(How can cell D2 - I get this cell to calculate the difference and say 02:50?)
I know it's probably one of the most basic operations, but for the life of me I can't understand it. The cells B2 and C2 are formatted for a 24-hour clock. But if I tell the system to just subtract the two, I get "0,118. Everything I find on the forum search goes beyond what I need. Can someone help me?
Thank you
Hi sapirs,
Departure and arrival of the cells are in Date and time with Date format: no and time: 24-hour clock.
Formula in D2 (fill down)
= C2−B2
The results become a duration format, but under automatic (numbers automatically worth this format)
If you wish, you can change the cells of lasting results.
What Data Format have your result cells?
Kind regards
Ian.
-
calculate the time difference between several lines
Hello
I have a table as below:
create table select TEST_CASETBL (ID, CASE_NUM, CASE_STATUS, CASE_SUB_STATUS, LAST_UPD_DTTM)
112, 123-456', 'open', 'Work', TO_DATE (11 March 2015 13:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select
113, 123-456', 'Open', 'pending on the admin', TO_DATE (10 January 2015 15:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select
114, 123-456', 'Open', 'client expectation', TO_DATE (10 July 2015 09:00 ',' hh24:mi:ss' of dd/mm/yyyy) of the DUAL union all select them
315, 123-456', 'open', 'Work', TO_DATE (September 15, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select
219, 123-456', 'Open', 'pending on the admin', TO_DATE (January 9, 2015 08:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select
651, 123-456', 'open', 'Work', TO_DATE (August 20, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') from DUAL;
I would like to calculate the duration total (days ideally) to CASE_SUB_STATUS, so have a set of lines:
CASE_NUM of work waiting on admin waiting on customer
-------------------------------------------------------------------------------------------------------------------------------------------------------
123-456 70days 6 hours
Here is the explanation of the pattern:
ex: for everyday business computing (timestamp timestamp of ID:651 - ID:219) +(timestamp of ID:315-timestamp of ID:114) + (ID:112 stamp - current_time) = 11 days + 21 days 22hrs 23hrs 36 days 9 hours
still waiting on admin
(ID:219 timestamp - timestamp of ID:315) + (ID:113 timestamp - timestamp of ID:112)
still waiting on the client
(ID:114 timestamp - timestamp of ID:113)
I would appreciate any idea how to solve this, ideally as an SQL
Thank you
Should he not?...
with test_casetbl (id, case_num, case_status, case_sub_status, last_upd_dttm) as)
Select 112, 123-456', 'Open', 'Work', TO_DATE (11 March 2015 13:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union
Select 113, 123-456', 'Open', 'pending on the admin', TO_DATE (10 January 2015 15:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union
Select 114, 123-456', 'Open', 'client expectation', TO_DATE (10 July 2015 09:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union
Select 315, 123-456', 'Open', 'Work', TO_DATE (September 15, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union
Select 219, 123-456', 'Open', 'pending on the admin', TO_DATE (January 9, 2015 08:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union
Select 651, 123-456', 'Open', 'Work', TO_DATE (August 20, 2015 10:00 ',' the hh24: mi: ss' dd/mm/yyyy) double
),
t like)
Select case_num,
case_sub_status,
(last_upd_dttm, 1, sysdate) ahead of diff last_upd_dttm (partition by order of last_upd_dttm case_num).
of test_casetbl
)
Select case_num,
trunc (a) | "day (s). TO_CHAR (date ' 1-1-1' + a, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") "work."
trunc (b) | "day (s). TO_CHAR (day 1-1-1' + b, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") 'Waiting on admin',
trunc (c) | "day (s). TO_CHAR (day 1-1-1' + c, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") "waiting on customer."
t
pivot)
Sum (diff)
for case_sub_status in)
'Work' is.
B "waiting on admin',
C "customer expectation."
)
)
CASE_NUM Working Waiting on admin Waiting on customer 123-456 63 day (s) 22 hour (s) (s) 50 minute 49 second (s) 19 day (s) on 20 (s) hour 0 minute 0 second (s) 27 day (s) on 4 hour (s) 0 minute 0 second (s) -
How to calculate the difference between two numbers in text fields
Hello, I am fairly new to this, and I am certain that I will be bothered by the simple answer is
I do a simple calculation... total of total assets - liabilities = net worth
I have my total assets and my total work of the liability, but is not a subtraction option in the properties of a text field for the Net of a field value.
I don't know... not any script Java can any who help out me?
Thank you
Judy
You can use the option of simplified field notation, but first your input fields names must be changed so that they do not contain spaces or punctuation. For example:
TotalAssets - TotalLiabilities
If you want to use JavaScript, what will be needed if you ever in more complicated calculations, you can use something like the following as the custom fields (net value) calculation script:
(function () {}
Get the values of the field as numbers
var v1 = + getField("total_assets").value;
var v2 = + getField("total_liabilities").value;
calculate the value of this field
Event.Value = v1 - v2;
})();
There are no restrictions on domain names when using JavaScript.
-
Calculate the hours between 2 business days
Hi all
Do a complex calculation on the days I do not know how to achieve this.
Here is my case:
I have a week of work with hours of work.
Then there's this delivery time sheet for how long should be set an order ready to be delivered:
Order1: max 5 hours of work
Order2: max 8 working hours
Order3: max 16 hours of work
When an order is placed, the time of the order is recorded, and when an order has been set in ready to be delivered, this time is also registered.
How to calculate the time difference between the time where an order has been placed and the time where the order has been on loan. Thereby also taking into account the working days and hours of work.
Example: type order1 order was placed Tuesday at 15:00.
Order has been fixed loan Wednesday at 14:00
This means that to fix this ready order lasts 7 hours, which means that it is 2 hours time.
CREATE TABLE REF_WORKDAYS ( "WERKDAG" VARCHAR2(15 ) NOT NULL ENABLE, "SOORT_WERKDAG" VARCHAR2(15 ) NOT NULL ENABLE, "BEGIN_TIJD" VARCHAR2(10 ) NOT NULL ENABLE, "EIND_TIJD" VARCHAR2(10 B) NOT NULL ENABLE, )
Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Monday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Tuesday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Wednesday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Thursday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Friday','WORKINGDAY','08:00','16:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Satrurday','WORKINGDAY','08:00','14:00'); Insert into REF_WORKDAYS (WERKDAG,SOORT_WERKDAG,BEGIN_TIJD,EIND_TIJD) values ('Sunday','NOT-WORKINGDAY','08:00','16:00'); COMMIT;
create table glas_order (order_id number , order_desc varchar2(100) not null , order_type varchar2(10) not null , order_date date not null , order_ready date );
Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (1,'order bla','Order1',to_date('07-APR-15 09:00','DD-MON-RR HH24:MI'),to_date('08-APR-15 12:00','DD-MON-RR HH24:MI')); Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (2,'order nice','Order1',to_date('14-APR-15 10:00','DD-MON-RR HH24:MI'),to_date('16-APR-15 16:00','DD-MON-RR HH24:MI')); Insert into GLAS_ORDER (ORDER_ID,ORDER_DESC,ORDER_TYPE,ORDER_DATE,ORDER_READY) values (3,'order ugly','Order2',to_date('18-APR-15 13:00','DD-MON-RR HH24:MI'),to_date('21-APR-15 09:00','DD-MON-RR HH24:MI')); COMMIT;
Thank you
Diana
Select
I like order_id
such as length d
order_type
d decode(order_type,'Order1',5,'Order2',8)
overtime
of glas_order o
model
Reference r on
(select
WERKDAG w
begin_tijd b
e eind_tijd
, (to_date (eind_tijd, 'HH24') - to_date (begin_tijd, 'HH24')) * 24 hard
of ref_workdays
where soort_werkdag = "WORKINGDAY")
dimension (w)
measures (b, e, hard)
main m
partition of (order_id I)
size of (0 n)
measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as wday, order_type)
iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))
WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')
, d [0] = d [0] +.
case
When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day
then presentv (r.b [wday [0]],)
less (largest (order_ready [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')), to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))
-bigger (to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI'), least (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))))
0) * 24
When order_date [0] + iteration_number = order_date [0] - first day
then presentv (r.b [wday [0]],)
TO_DATE (to_char (order_date [0], 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')
-bigger (order_date [0], to_date (to_char (order_date [0], 'YYYYMMDD') | r.b [WDAY [0]],'YYYYMMDDHH24:mi'))))
0) * 24
When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day
then presentv (r.b [wday [0]],)
less (order_ready [0], to_date (to_char (order_ready [0], 'YYYYMMDD') | r.e [WDAY [0]],'YYYYMMDDHH24:mi'))))
-to_date (to_char (order_ready [0], 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')
0) * 24
of another nvl (r.dur [wday [0]], 0)
end
)
ORDER_ID DURATION ORDER_TYPE OVERTIME 1 11 Order1 6 2 22 Order1 17 3 10 Order2 2 Rewrittten party rules for readability purposes (more resources)
measures (0d, order_date, order_ready, cast (null as varchar2 (10)) as to_date (null), (null) to_date, bd, order_type, wday ed)
iterate (1e6) rules until (iteration_number > = trunc(order_ready[0]) - trunc(order_date[0])))
WDAY [0] = to_char (order_date [0] + iteration_number, 'FMDay', 'NLS_DATE_LANGUAGE = ENGLISH')
, comics [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.b [WDAY [0]], 'YYYYMMDDHH24:MI')
, ed [0] = to_date (to_char (order_date [0] + iteration_number, 'YYYYMMDD') | r.e [WDAY [0]], 'YYYYMMDDHH24:MI')
, d [0] = d [0] +.
case
When trunc(order_date[0]) = trunc(order_ready[0]) - beginning and ready same day
then presentv (r.b [wday [0]],)
less (largest (order_ready [0], [0] bd), ed [0])
-Greatest (BD [0], least(ORDER_DATE[0],ED[0]))
0) * 24
When order_date [0] + iteration_number = order_date [0] - first day
then presentv (r.b [wday [0]],)
ED [0]
-Greatest(ORDER_DATE[0],BD[0])
0) * 24
When trunc(order_date[0]) + iteration_number = trunc(order_ready[0]) - last day
then presentv (r.b [wday [0]],)
least(order_ready[0],ED[0])
-bd [0]
0) * 24
of another nvl (r.dur [wday [0]], 0)
end
)
Jubilee should be Saturday I guessed.
-
difference between two dates in the year/month/day in Obiee
Hi gurus,
I know this question have been asked and answered several times but I have a requirement that is a little different, then the previous ones.
I want to calculate the difference between two dates in OBIEE10g in year/month/day format similar to the below SQL output
SQL > select end_date, start_date,
trunc (months_between (end_date, start_date) / 12) years.
months of mod (trunc (months_between (end_date, start_date)), 12).
End_date - add_months (start_date, trunc (months_between (end_date, start_date))) days
t
Thanks in advance
SK
Search for this
"TIMESTAMPDIFF IN THE FORM OF MTHS # YEARS."
or else
To get the current mandate of employees since the date of hiring in the form of # years # mths or # year (s) # month (s)
Concat (concat (cast (TIMESTAMPDIFF (SQL_TSI_Month, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) / 12 as char),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Month (s)'))
Concat (concat (CAST (TIMESTAMPDIFF (SQL_TSI_YEAR, "Employee attributes". (((' ' Hiring last Date employee ", CURRENT_DATE) as CHAR),"Year (s)"), concat (cast (MOD (TIMESTAMPDIFF (SQL_TSI_Month,"Employee attributes". (((((' ' Hiring last Date employee ", CURRENT_DATE), 12) as char), 'Mth (s)'))
-
Hi Expert,
First of all, thanks for reading my question...
I am new to HFM and need help with writing a rule to assign the difference between the end of the period (EOMRate) and (AVGRate) average for foreign translation account currency (FCTRS):
Requirements of the rule:
1. go to the base to all entities that are non-AUD (Parent entity is denominated in AUD)
2. work on the difference between EOMRate and AVGRate rates
3 multiply the difference with the account of profit after tax (IE PAT)
4. this amount should be included in the account of FCTRS (IE 9115)
Rule I wrote, who dislikes the HFM:
If HS. Entity.IsBase("","") = True and HS. Value.Member <>'AUD' then
HS. Exp ' a 9115 # = a #PAT * difference ("AVGRate", "EOMRate").
End If
AVGRate and EOMRate that I'm looking rates in C2. This rule gave a certain number of attempts, but without success. Would appreciate expert you worldwide HFM...
Thanking you in advance.
The f
Hi Jeff,
I think you need to use the sub translate and do some additional calculations.
You can start by adding the translation of this rule in the sub and the system will calculate the difference: HS. TRANS 'movement of the target, Source movement, EOMRate, AVGRate. For the rest of the needs, just adapt the above rule...
Kind regards
Thanos
-
How to calculate the number of days/weeks/months between 2 dates?
Hello
I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.
Thank you!
JamieHi Jamie,
Through this links...
http://www.bravesoft.com/blog/?p=682
http://twobiee.blogspot.in/2012/01/working-with-date-differences.htmlMark as correct it allows u...
Thank you... -
Calculate the (age) years between two dates
Nice day!
I have not been able to find an answer, that I was able to use in the archives or online and would be very grateful for the help. I'm working with Adobe Acrobat Pro XI (not LiveCycle) and I have very little experience with programming (for the most part, copy / paste).
I need to create a text box that calculates the number of years between two dates entered, i.e. the age when the date of birth and death are given. Also, would be nice if she was a Virgin until the two were provided. Anyone would be able to give me the code I need to put in the custom calculation script?
Once again, any help would be much appreciated! Thank you and have a wonderful day!
For the fields for Date of birth DOB and DOD for the Date of death and age in complete years both by using a'd-mmm-yyyy' date format you can use a custom calculation to the JavaScript for the field of age as:
function GetField (cName) {}
get the field with error trapping object;
oField var = this.getField (cName);
test error;
if(oField == null) app.alert ("error during the" + cName, 1, 0);
Returns the field object;
return oField;
} / / end GetField function;function {Scand (cFormat, cString)
using date string format convert object date;
convert string to date using format;
Kai var = util.scand (cFormat, cString);
the value null is an error of conversion;
if(oDate == null) app.alert ("Conversion error" cString "by using the format" + cFormat, 1, 0);
date of return;
Return to oDate;
} / / end Scand function;clear the value of the field;
Event.Value ="";
get data dob and dod;
var oDOB = GetField ("DOB");
Var o = GetField ("DOD");treat only if DOB and DOD have value and are not null;
If (oDOB! = null & o! = null & oDOB.value! = "" & oDOD.value!) = "") {}convert the DOB and DOD to date objects.
oDOB var = util.scand ("d-mmm-yyyy", oDOB.value);
O var = util.scand ("d-mmm-yyyy", oDOD.value);get the difference over the years;
var Age = oDOD.getFullYear () - oDOB.getFullYear ();adjust for month of previous DOD DOB;
If (oDOD.GetMonth)< odob.getmonth())="">adjust the DOD before DOB date in the month of birth;
If (oDOD.GetMonth () == oDOB.getMonth () & oDOD.getDate ())< odob.getdate())="">
Set the value of the field;Event.Value = Age;
} -
Calculation of the time differences between several lines
Hello
I have a table as below:
EVENT ID DATE
1. start 05/03/2012-13:00
1. stop the 15:00 05/04/2012
1. start 09:00 05/07/2012
1 stop on 05/09/2012 10:00
Start 2 08/06/2012-08:00
2 stop on 08/07/2012 10:00
I would like to calculate the duration (in hours ideally) between 'Start' and 'Stop' for each ID, so having a set of lines:
ID TimeSpan
---------------------
1 75
26 2
I would appreciate any idea how to solve this, ideally as a SQL solution or maybe a function.
Thank you very much!
TomThe difference between two dates is a number, where 1 = 1 day. Multiply by 24 to get hours.
Use the LAG, as stated above, to compare the date prior to the current date.
create table T(TID, EVENT, TDATE) as select 1, 'start', TO_DATE('03/05/2012 13:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select 1, 'Stop', TO_DATE('04/05/2012 15:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select 1, 'start', TO_DATE('07/05/2012 09:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select 1, 'Stop', TO_DATE('09/05/2012 10:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select 2, 'start', TO_DATE('06/08/2012 08:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select 2, 'Stop', TO_DATE('07/08/2012 10:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL; select tid, round(sum(hours)) hours from ( select case when EVENT = 'Stop' then 24*(TDATE - LAG(TDATE) over(partition by TID order by TDATE)) else 0 end hours, TID from T ) group by tid; TID HOURS --- ----- 1 75 2 26
Maybe you are looking for
-
I tried to add a site blocked to adblock and now I lose my format for my Yahoo mail page.
Instead of to the page size of regular mail I get a single column summary of my mail. I can't grab it. I disable adblock and my page is normally formatted. I walked into this condition, trying to block ads that appear on the page Yahoo database.
-
new profile of 3rd appearing is not in the Profile Manager
created a 3rd profile will not be displayed in the profile of Mgr it appears right after that I created it, but after I closed the browser, it will not be displayed in the profile of Bishop I read somewhere once how to solve this problem, but don't r
-
This morning Satellite 100 my wife running Windows Vista itself got in a loop of the system, with absolutely no discernible way out recovery. I have so for you guys to see if anyone has had the same problem. First of all, the system stops (battery pr
-
Re: Touchpad XP driver for Satellite 1410 604
I'm looking for the * touchpad driver * (Windows XP Pro) for the Toshiba * Satellite 1410 604 *.This model seems unknown to the download site. Does anyone know what other (known) model, it is or where I could find a compatible driver?----Is there a u
-
Printing from a computer client NICU Terminal Server in windows Server 2003
My problem is: Client computers had already installed 2 printers that users need to be able to print, but when they access the Server 2003 and you want to change the default printer, they can not, only the administrator is able to change the default