How to calculate the periods that overlap between two or more given the date range?

Hi all

If there are several durations then how we can calculate the period of time that overlap between these times.

For example: for 3 time periods. 03/12/2015-16/08/2015, 05/01/2015 to 31/07/2015 and the 06/09/2015 to 30/11/2015, how the overlap period can be calculated?

There are many potential unknowns in your question.  For example, you want to count any overlap at all?  If two dates overlap, what matters?  Overlap - each of them?

In any case, here is a solution that counts how many periods are overlapping in any point in time...  She, of course, using temporal logic.  You can then use ValueAt(), WhenLast(), WhenNext(), etc. as appropriate.

Assume that your model has a child entity called 'the period' with name 'all time periods' relationship and basic attributes 'start date of the period of time' and 'date of end of period of time'.

In your example:

an entity should have the time period start date = 03/12/2015 and the date of end of period of time = 16/08/2015

another entity might have the time period start date = 01/05/2015 and the date of end of period of time = 31/07/2015

another entity might have the time period start date = 06/09/2015 and the date of end of period of time = 30/11/2015

To find the number of overlapping over time, we want to count or entities that have an active period, so the rule is perhaps the sum:

the number of overlapping = the number of all the periods for which it is true that the time period is active

How do we know a time is active?  This is the time logic comes in.  He is active on or after the start date or no later than the end date:

the time period is active if

TemporalOnOrAfter (the date of beginning of period of time) and

TemporalOnOrBefore (date of end of period of time)

That's all.  Now, you can perform a temporal visualization of the 'number of overlapping' and you'll see it rise and fall over time.  As a reference, he said that the number of overlapping = 3.0 from 06/09/2015 across 31/07/2015.

I hope this helps.  You can use the same model to count periods of time functions, but you end up having to use the most logical date.  You of course can count the total number of entities and compare this number of overlap over time to see if they overlap, but I digress...

Tags: Oracle Applications

Similar Questions

  • How to calculate if an object is between two points

    Okay so I'm an RTS game, and ive got my participants

    displacement = false;

    CheckIt = false;

    startPt = {};

    Start = {};

    var i = 0;

    Fill._alpha = 0.1;

    onMouseDown = function() {}

    move = true;

    startPt.x = _xmouse;

    startPt.y = _ymouse;

    }

    onMouseUp = function() {}

    displacement = false;

    CheckIt = true;

    endPt.x = _xmouse;

    endPt.y = _ymouse;

    square_mc var = this.createEmptyMovieClip ("" + i, i ++);

    square_mc.beginFill (Fill);

    square_mc. MoveTo (startPt.x, startPt.y);

    square_mc. LineStyle (4, 00000000, 50);

    square_mc. LineTo (_root._xmouse, startPt.y);

    square_mc. LineTo (_root._xmouse, _root._ymouse);

    square_mc. LineTo (startPt.x, _root._ymouse);

    square_mc. LineTo (startPt.x, startPt.y);

    square_mc.endFill ();

    square_mc = null;

    }

    onEnterFrame = function() {}

    If (! dragging and checkit) {}

    scroll through the objects and see if they are with startPt, endPt

    CheckIt = false;

    }

    }

    And I want to check if my workers are between the two points (well 4) of:

    startPt.x

    startPt.y

    endPt.x

    endPt.y

    Ive tried this

    If (_root.workers [i] ._x > startPt.x & & _root.workers [i] ._y > startPt.y & & _root.workers [i] ._x > endPt.x & & _root.workers [i] ._y > endPt.y | _root.workers [i] ._x < startPt.x & & _root.workers [i] ._y < startPt.y & & _root.workers [i] ._x > endPt.x & & _root.workers [i] ._y > endPt.y) {}

    workers [i]. Selected = true;

    Workers [i] .gotoFunction ();

    }

    But I don't think that it's actually calculate if the worker [i] is between these points.

    so could someone please tell me how to calculate if my work is between these points, so I could do then selectable

    Thanks in advance

    I don't think you have this conditional is to check what you're saying, you want to check... try...

    If (_root.workers [i] ._x > startPt.x & _root.workers [i] ._y > startPt.y & _root.workers [i] ._x)< endpt.x="" &&="" _root.workers[i]._y=""><>

  • How to calculate the date from sysdate


    I try to get 12/09/2009-12:51:30 by subtracting the current date to sysdate.

    I can get with this year, but I don't know how I can get to the date and the month preceding.

    () Choose add_months (sysdate-36() of double) = 12/09/2010

    Planned result 12/09/2010 13:23:30

    Thank you for the help

    I'm assuming that time is fixed if it is to see the example below.

    SQL > select add_months (to_date (to_char(sysdate,'dd-mon-yyy') |)) (("" 12:51:30 ',' dd-MON-yyy hh: mi: ss AM "), - 36) prior_date
    2 double;

    PRIOR_DATE
    -----------------------
    12 - Oct - 2010 12:51:30

    SQL >

  • How to calculate the date interval

    Hi Experts,

    I'm looking for a way to calculate the interval between two dates. And get the result to the format "dd.mm.yyyy hh24:mi:ss.
    select  sysdate - to_date('1.1.2000 12:00:00','dd.mm.yyyy hh24:mi:ss') from dual
    Best practices for a problem like this?

    Best regards
    Igor
    select trunc( months_between( day2, day1 ) / 12 ) years
         , mod( trunc( months_between( day2, day1 ) ), 12 ) months
         , numtodsinterval( day2 - add_months( day1, trunc( months_between( day2, day1 ) ) ), 'DAY' ) rest
    from ( select to_date( '19-01-1979', 'dd-mm-yyyy' ) day1, sysdate day2 from dual )
    
  • How to calculate the data according to the fiscal

    I want to dispaly the result for  the accounting year from April to March for any accounting year (Accounting year is from April to March). 
    I have a table INVOICE. 
    
    CREATE TABLE INVOICE
    (
      IN_NO       NUMBER,
      IN_DT       DATE,
      IN_DETAILS  VARCHAR2(20 BYTE)
    )
    
    I want to calculate display the result for accounting year from April 2010 to March 2011, and from April 2011 to MArch 2012.
    What statement should i use to filter the data as above ?
    
    Sanjay

    user12957777 wrote:

    I want to dispaly the result for  the accounting year from April to March for any accounting year (Accounting year is from April to March).
    I have a table INVOICE. 
    
    CREATE TABLE INVOICE
    (
    IN_NO       NUMBER,
    IN_DT       DATE,
    IN_DETAILS  VARCHAR2(20 BYTE)
    )
    
    I want to calculate display the result for accounting year from April 2010 to March 2011, and from April 2011 to MArch 2012.
    What statement should i use to filter the data as above ?
    
    Sanjay
    

    You should now learn to use correctly

     tags
    
    select to_char(add_months(in_dt,-3),'YYYY') FISCAL_YEAR FROM INVOICE;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • How to use the Date range parameter.

    Dear all,

    In the human resources Module, I developed a leave leave of synthesis report that gathers data from employees on.

    The end user will pass the parameter of date_start and date_end.

    The question is, if an employee only e-123 takes leave of 22 July 2013 to August 10, 2013

    and the user passes the parameter for the month of July date_start = 1 July 2013 "and date_end = July 31, 2013" for the sub condition

    "AND TRUNC (Pab.DATE_START) > =: Date_START - July 1, 2013.

    "AND TRUNC (Pab.DATE_END) < =: Date_END - July 31, 2013.

    Emp E-123 appears in the report.

    But if the user passes the parameter of the month August 1 August 2013 ", 31 August 2013", EMP - 123 does not...

    Please suggest how to write the condition he can for all conditions.

    Kind regards

    Afzal.

    Hello

    OR condition is to be enclosed with parentheses.

    If place you within the parenthesis, then take no time to deal with.

  • How to pass the date range as in URL filter go

    Hello

    I am trying to build a Url go that has two filters, date range & text. I built the url below, but he continues to throw an error. The url is not from the date max and the app starts following error:

    Error: Status: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 46048] Month DateTime value 0 0000-00-00 is off limits. (HY000)

    Go to Url: https:companyUrl? GB & Options = rfd & Path = / shared/CompanyID/link & P0 = 2 & P1 = eq & P2=CustomObject4.%22Indexed%20Pick%201%22 & P3 = Leasing & bet = P4 & P5 = ""-CustomObject4 Custom Attributes '. " ZDate_26 & P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'


    Please suggest.

    Thank you
    Kiran.

    It seems that you convert the data type of char to date in the URL, I don't think that this is possible.
    Your code is like
    & P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'

    It suppose to be & P6 = 2 + 2014-08-01 + 2014-12-31

    I suggest doing the formatting for this filed using column properties and try.

    Hope this help, pls mark if yes ;)

  • How to calculate the date fields while excluding Saturday and Sunday

    Hi, I use Jdeveloper 11.1.3.4

    I have an Oracle database and creates a table called holiday with 3 attributes:


    user (VARCHAR)

    (early)

    end (date)


    The idea is that you subtract the finish from the beginning and get a number of vacation days used. The thing is that the sum should exclude Saturday and Sunday.

    Any way to do it?
    /* Formatted on 6/1/2011 7:57:32 AM (QP5 v5.149.1003.31008) */
    WITH t AS (  SELECT id,
                        MAX (strt) strt,
                        MAX (finish) finish,
                        SUM (dys) days_off
                   FROM (SELECT id,
                                strt,
                                finish,
                                CASE
                                   WHEN TO_CHAR (dy, 'day') LIKE 'saturday%' THEN 0
                                   WHEN TO_CHAR (dy, 'day') LIKE 'sunday%' THEN 0
                                   ELSE 1
                                END
                                   dys
                           FROM vacations
                         MODEL
                            PARTITION BY (ID id)
                            DIMENSION BY (0 d)
                            MEASURES (POCETAK strt, KRAJ finish, POCETAK dy)
                            RULES
                               (dy [FOR d FROM 1 TO finish[0] - strt[0] INCREMENT 1] =
                                     (NVL (dy[CV () - 1], dy[CV ()]) + 1)))
               GROUP BY id
               ORDER BY id)
    SELECT t.id,
           t.strt,
           t.finish,
           t.days_off,
           vacations.korisnik,
           SUM (
              CASE
                 WHEN finish < TO_DATE ('01/07/2011', 'dd/mm/yyyy') THEN days_off
                 ELSE 0
              END)
           OVER (PARTITION BY vacations.korisnik ORDER BY t.id)
              this_years_running_total,
           SUM (
              CASE
                 WHEN finish < TO_DATE ('01/07/2011', 'dd/mm/yyyy') THEN days_off
                 ELSE 0
              END)
           OVER (PARTITION BY vacations.korisnik)
              this_years_grand_total,
           SUM (
              CASE
                 WHEN finish >= TO_DATE ('01/07/2011', 'dd/mm/yyyy')
                 THEN
                    days_off
                 ELSE
                    0
              END)
           OVER (PARTITION BY vacations.korisnik ORDER BY t.id)
              next_years_running_total,
           SUM (
              CASE
                 WHEN finish >= TO_DATE ('01/07/2011', 'dd/mm/yyyy')
                 THEN
                    days_off
                 ELSE
                    0
              END)
           OVER (PARTITION BY vacations.korisnik)
              next_years_grand_total
      FROM t, vacations
     WHERE t.id = vacations.id
    
    id                    strt               finish        daysoff          korisnik    thisyrruntot  thisyrtot   netyrruntot    nextyrtotal
    1     5/25/2011     5/31/2011     5     Kantardzic     5     22     0     26
    2     6/6/2011     6/13/2011     6     Kantardzic     11     22     0     26
    5     6/1/2011     7/6/2011     26     Kantardzic     11     22     26     26
    6     6/16/2011     6/30/2011     11     Kantardzic     22     22     26     26
    
  • 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!
    Jamie

    Hi Jamie,

    Through this links...

    http://www.bravesoft.com/blog/?p=682
    http://twobiee.blogspot.in/2012/01/working-with-date-differences.html

    Mark as correct it allows u...
    Thank you...

  • How to calculate the execution time of a SCTL in FPGA VI?

    Hello

    Can someone guide me that how to calculate the execution time of a SCTL for an iteration in the FPGA VI?

    Thank you and best regards,

    Rashid

    Hello r,.

    A SCTL will always run in a beat the clock it has been linked to.  So, if you use a 40 MHz clock, this loop will run in 25 ns.  If the code cannot complete in that, or if it requires two graduations of the watch to do the calculation, your code does not compile, then you have the guarantee that this will always be how long it takes this piece of code to run.

  • To build the waveform.vi function how to calculate the value of dt

    Dear all

    Please guide me How to calculate the value of dt according to waveform.vi of construction

    My sampling rate is 25000 and I take 200000 samples.

    Kind regards

    Muhammad Irfan

    It's all simple arithmetic. The inverse of the sampling frequency power of samples is then the dt or the time between samples the number of samples is not relevant.

  • How to calculate the execution time of a loop?

    Hello

    Can someone guide me that how to calculate the execution time of a loop to iterate?

    Thank you and best regards,

    Rashid

    I hope I have your question! See attached screenshot

  • How to calculate the polynomial graphic adjustment of waveform

    Hi all

    I am new to lab - view so would need a little assistance in one of the problem I have right now.

    My problem is: how to calculate the polynomial graph of waveform data adjustment? I need to convert the waveform to XY graph data, and then use the polynomial vi made integrated to calculate the fitting?

    Detail: My problem is that I have waveform graph, I calculate the vertices and the Valley, but because of the noise, my peaks and Valley detection is sometimes not exact, so to smooth the chart that I must apply the polynomial fit.

    If anyone can help me in this, I'll be very grateful.

    Thanks in advance

    Hi Omar,.

    have you seen the suggestion of Lynn above?

    You already have the values of Y (your table). Now, you need build the table of X as indicated, only to replace the value of dt with your spacing from point to point. Somewhere in your code, you know that the value that you have an x-axis indicated in milliseconds...

  • How to calculate the CPU Ready on Cluster DRS via Powercli?

    Hi all!

    I have a DRS Vsphere cluster. I want to know what is the value of the loan of CPU I have in my group.

    For example, I get 20% of powercli value, it is normal for the cluster, but if I have 100% or more, I have a problem.

    How to achieve via Powercli? And how to calculate the percentage values correctly?

    I know, I can get all values of CPU Ready of VMs cluster, but IT is not the same thing, I need overall value of CPU Ready.

    Thanks in advance!

    As far as I know you can get the cpu.ready.summation for ESXi nodes or VMs.

    For a cluster, you will need to get the value of each node in the cluster ESXi and then take the average.

    The metric cpu.radey.summation is expressed in milliseconds.

    To get a percentage, you need to calculate the percentage of loan period during the interval during which it was measured.

    Something like this (this will give the loan current %)

    $clusterName = "mycluster.

    $stat = "cpu.ready.summation".

    $esx = get-Cluster-name $clusterName | Get-VMHost

    $stats = get-Stat-entity $esx - Stat $stat - Realtime - MaxSamples 1 - forum «»

    $readyAvg = $stats | Measure-object-property - average value. Select - ExpandProperty average

    $readyPerc = $readyAvg / ($stats [0].) IntervalSecs * 1000)

    Write-Output "Cluster $($clusterName) - CPU % loan $(' {0:p}'-f $readyPerc).

  • How to calculate the cpu in the resource pool

    How to calculate the cpu in the resource pool

    and don't forget that shares in pools of resources are not inherited by the virtual machines in the pools. the action is related to the pool itself.

Maybe you are looking for