Calculating hours in numerical formats between 2 business days, calculated column

Hi there,
I need to calculate how many hours are between 2 days only including business days, outputting in numerical format (ex. 7.3). 
I've been using this formula to output how many weekdays are between 2 days.
=IF(AND((WEEKDAY(CompletedTimeStamp,2))<(WEEKDAY(,2)),((WEEKDAY(Created,2))-(WEEKDAY(CompletedTimeStamp,2)))>1),(((DATEDIF(Created,CompletedTimeStamp,"D")+1))-(FLOOR((DATEDIF(Created,CompletedTimeStamp,"D")+1)/7,1)*2)-2),(((DATEDIF(Created,CompletedTimeStamp,"D")+1))-(FLOOR((DATEDIF(Created,CompletedTimeStamp,"D")+1)/7,1)*2)))
The problem with this is if the 2 dates are on the same day, it outputs "1". I need it to output the amount of hours then / by 24 to give me ".7"  instead.
Is there anything I can do to convert this current formula to give me hours instead of days?
Thanks,
Terence

The DATEDIF is rounding to the nearest day.
Try this:
=IF(AND((WEEKDAY(CompletedTimeStamp,2))<(WEEKDAY(,2)),((WEEKDAY(Created,2))-(WEEKDAY(CompletedTimeStamp,2)))>1),(((CompletedTimeStamp-Created+1))-(FLOOR((CompletedTimeStamp-Created+1)/7,1)*2)-2),(((CompletedTimeStamp-Created+1))-(FLOOR((CompletedTimeStamp-Created+1)/7,1)*2)))
-1
Then above will return fractions of days, i.e.  5.5 days. Multiply this by 24 for hours.
I think there is a extra "+1" in the above example somewhere, so I added a minus 1 to get back the correct value.
Hi.. Mike.. I am trying to use this calcuation.. its renndering "time being used 3.3".. I need it to calcuate a work day as 8 hrs  so if
Start Date= 9/12/2014 9:00am
End Date= 9/16/2014 5:00 pm
should be 3 (8 hr work days)  any way I can fix this?
Thanks in advance for your help.
Mike Smith TechTrainingNotes.blogspot.com

Similar Messages

  • Calculation of due date based on Business Days for FICA documents

    Hi All,
    I am working on project where SD - FICA integration is in picture. We post some charges through SD and FICA document gets posted on relevant Contract Account.
    Normally we create Sales Order using transaction VA01 and then we do Billing for this Sales Order through VF01. After billng is done, FICA document automatically gets generated.
    We have following requirement to be fulfilled.
    For the SD bills posted as above, I want to calculate due date of these bills based on Business Days for FICA document generated (SAP Standard calculate due date based on Calander days). We can use factory calander for calculating business days in relevant function module.
    I have checked in the system and it seems that event 1330 ( FM - ISU_DUE_DATE_DETERMINE) is not working in this scenario. Is there any other FM which I can use?
    Can anyone help me on this?
    Regards,
    Pradeep

    Hello Praeva ,
    The event 1330 has a sample FM FKK_SAMPLE_1330. It doesnt even have a Standard Function Module.
    You need to create a Installation-Specific FM and put your code to determine the Due Date based on the logic.
    Rgds
    Ram Kumar.

  • Oracle 8i: Business Days Calculation in a Subquery

    To Whom It May Concern:
    I apologize if this has been posted already, but I didn't find any threads that address my issue:
    I need to find the number of business days between 2 dates (excludes weekends) provided by dates from an outer query such as the following:
    SELECT
         C.CUSTOMER_ID
         , C.ENTRY_DATE
         , C.COMPLETION_DATE
         , <SOME SUBQUERY HERE THAT CALCULATES THE NUMBER OF BUSINESS DAYS BETWEEN C.COMPLETION_DATE AND C.ENTRY_DATE> AS BUSINESS_DAYS
    FROM CUST_TABLE C
    Thanks for your time and advice.
    Max

    you don't need a subquery. it's a very simple formula
    Re: query regarding dates
    (you may need to change the case to a decode for v8 - I don't remember when it was introduced)

  • Business Day Calculation

    I would like to add x number of business days to a date extracted from Discoverer Plus. How might one do so?

    Hi,
    I think passing v_nextBusinessDate for checking holiday will solve your problem. Please refer bold lines.
    create or replace function getNextBusinessDay(IN_DATE date)
         return date
         is
              v_nextBusinessDate date;
              v_isAHoliday boolean;
         begin
              v_isAHoliday := false;
              v_nextBusinessDate := IN_DATE;
              loop
                   v_isAHoliday := check_holiday(v_nextBusinessDate);
                   if (v_isAHoliday = false)
                   then
                        exit;
                   else
                        v_nextBusinessDate := v_nextBusinessDate+ 1;
                   end if;
              end loop;
              return v_nextBusinessDate ;
         end;

  • Numeric format i Business Object

    Hi
    We are trying to build a Business Objects reporting solution on top of SAP BW, but we are experience a lot of problems but most of all is that Business Objects is not reading the information form SAP BW correct.
    Numc format on a infoobject is converted into char value in the Business Objects univers.
    Does anyone have a solution to that problem and I don't want to convert it in the report but in the univers
    Best Regards
    Joachim

    thanks for the answer
    But...
    If you create  a numeric value in the report layer then you can't use the variable to join against another univers. Further more you have to create this varible each time you create a new report.
    Is there not another solution to this problem?
    Best regards
    Joachim

  • Fucntion to Calculate business days (exclude weekends & holidays) between two days

    Hello,
    I need to be able to calculate business days between two dates excluding weekends and holidays. I do have a date dimension and also flags which denote weekday, holiday. Would really appreciate help in building a udf for the business days calculation.
    Thanks,

    Hi, Please take a look and tweak accordingly. Best of luck.
    --Assuming data dimension table something like the following
    --tblDateDim (DT date primary key,
    flagHoliday bit,
    flagWeekday bit
    CREATE FUNCTION fnBusinessDays (
    @StartDate DATE,
    @EndDate DATE
    RETURNS INT
    AS
    BEGIN
    DECLARE @Days INT ;
    SELECT @Days = count(*)
    FROM tblDateDim --// date dimension
    WHERE
    ( DT BETWEEN @StartDate AND @EndDate) --// dt is date column in the table.
    AND --// also flags which denote weekday, holiday
    flagHoliday = 0 --// flagHoliday= 1--Holiday;= 0 --workingday/businessday
    AND
    flagWeekday = 1 --// FlagWeekday = 1--businessday ; =0 --weekend (Saturday and Sunday)
    RETURN (@Days)
    END
    GO

  • Business (Network) day Calculation in BOXI

    Post Author: dusty
    CA Forum: WebIntelligence Reporting
    Hi All,
    I was wondering if anyone has a business day calculation for BOXI.  I am fairly new to BOXI and any assistance will be greatly appreciated.
    Regards,
    Dusty

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    Dusty,
    Your question was posed a while back in another forum, please follow this link:
    http://technicalsupport.businessobjects.com/cs/forums/post/12622.aspx

  • Calculate "Business Days" and account for holidays

    I have played with Date math based on what I have found for documentation, and adding an arbitrary number of days is pretty easy. But what about adding an arbitrary number of business days? I found a web site that talks about "Next business day",
    which could be adapted I am sure, but it only accounts for weekends. I want to calculate the date an arbitrary number of business days from a provided date. So, +3 business days calculated from a Monday should produce the date of the following Thursday,
    and calculated from a Friday should produce the date of the next Wednesday. And calculated from Friday Sept 4, 2015 (Friday before Labor Day) should produce Thursday Sept 10, 2015.
    Given that Windows is very business focused, I wonder if there is some nice hidden .NET functionality to calculate business days based on holidays as well? I know, some offices might give extra days off, four day weekends, etc. But those would be edge case
    enough to be safely ignorable for my purposes. Indeed, even holidays could probably be ignored, but if there is a quick approach I would rather use it. If I would need to code some sort of Exchange calendar scraper or some such, I'll live with just accounting
    for weekends. ;)

    You can pull holiday info from outlook.hol file and do the date math based on it. It won't be 100% reliable though. Not all the holidays listed in calendar are non-business days (not in all countries at least). International support may also present additional
    issues: in some countries it is a common practice to "move" weekend days to fill a single day gap between holidays and weekend (which screws up next business day calc anyway, regardless of holiday info :-). Not to mention all the possible industry-wide
    or company specific policies regarding working days.
    Gleb.

  • Calculating Business Days(Start_dt - End_dt)

    Hi Friends,
    Could anyone of you help me to find out the business days(Excluding Saturdays and Sundays) between two dates.
    The difference should be calculated of both the Start_dt and End_dt values truncated. The result should be calculated and stored according to business days, it means weekend days are to be ignored.
    create table sample (id number,start_dt date,end_dt date). The table values are as follows;
    ID ; start_dt ; End_dt
    1 ; 08-02-2012 ; 15-02-2012
    2 ; 30-12-2011 ; 15-02-2012
    My output should be;
    ID ; start_dt ; End_dt ; Expected Business Days (Excluding Weekends)
    1 ; 08-02-2012 ; 15-02-2012 ; 4
    2 ; 30-12-2011 ; 15-02-2012 ; 33
    Please note that, the Start Date and End Date can be any date from any year. Please help me on this.
    Regards,
    Williams.
    Edited by: Williams on Feb 8, 2012 6:28 PM
    Edited by: Williams on Feb 8, 2012 6:29 PM

    Here's my first cut at it.
    SQL> WITH sample AS
      2  (
      3     SELECT 1 AS id, TO_DATE('08-02-2012','DD-MM-YYYY') AS start_dt, TO_DATE('15-02-2012','DD-MM-YYYY') AS end_dt FROM DUAL UNION ALL
      4     SELECT 2 AS id, TO_DATE('30-12-2011','DD-MM-YYYY') AS start_dt, TO_DATE('15-02-2012','DD-MM-YYYY') AS end_dt FROM DUAL
      5  )
      6  /* END SAMPLE DATA */
      7  SELECT id
      8       , start_dt
      9       , end_dt
    10       , COUNT(*)
    11  FROM   sample
    12  JOIN   ( /* Exclude Weekends */
    13           SELECT dt
    14           FROM  ( /* Generate a range that includes all days */
    15                   SELECT min_start_dt + (LEVEL - 1) AS dt
    16                        , TO_CHAR
    17                          ( min_start_dt + (LEVEL - 1)
    18                          , 'fmDAY'
    19                          , 'NLS_DATE_LANGUAGE=AMERICAN'
    20                          ) AS dy
    21                   FROM   ( SELECT MIN(start_dt) AS min_start_dt
    22                                 , MAX(end_dt)   AS max_end_dt
    23                            FROM   sample
    24                          )
    25                   CONNECT BY LEVEL <= max_end_dt - min_start_dt + 1
    26                 )
    27           WHERE dy NOT IN ('SATURDAY','SUNDAY')
    28         ) dys ON dys.dt BETWEEN start_dt AND end_dt
    29  GROUP BY id
    30         , start_dt
    31         , end_dt
    32  /
            ID START_DT            END_DT                COUNT(*)
             2 12/30/2011 00:00:00 02/15/2012 00:00:00         34
             1 02/08/2012 00:00:00 02/15/2012 00:00:00          6
    2 rows selected.I got different results then you though. Can you say why your counts are what they are?

  • Calculation of Business day in OBIEE

    Hi,
    How to calculate the business day in OBIEE by excluding both weekends and public holidays.
    Please guide me

    If you want the "nth business day," here is something I prepared.
    Understanding the Concept in Layman Terms
    The first step to deriving the calculation is looking at a calendar. For our example, we will calculate the 6th business day of each month.
    1) Observation One: When the first day of the month is Saturday, the 6th business day occurs when “today’s date minus the first-day-of-the month equals 9.”
    2) Observation Two: When the first day of the month is Sunday, the 6th business day occurs when the above calculation equals 8.
    3) Observation Three: When the first day of the month is Monday – Friday, the 6th business day occurs when the above calculation equals 7.
    Building the SQL
    Below are the SQL statements that correspond to the above observations:
    4) When the first day of the month is Saturday…
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) = 6 AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = 9
    5) When the first day of the month is Sunday…
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) = 7 AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = 8
    6) When the first day of the month is Monday – Friday…
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) NOT IN (6,7) AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = 7
    Putting the SQL Statements Together
    When any of the above conditions are true (“OR” between each condition), then (THEN) “today” is the 6TH business day; otherwise (ELSE) it is not the 6th business day. Below is the final SQL:
    CASE WHEN
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) = 6 AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = *9*
    OR
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) = 7 AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = *8*
    OR
    DAYOFWEEK(TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE)) IN (1,2,3,4,5) AND DAYOFMONTH(CURRENT_DATE)-DAYOFMONTH(TIMESTAMPADD(SQL_TSI_DAY,1,TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE)*-1,CURRENT_DATE))) = *7*
    THEN '6th Business Day' ELSE 'Not 6th Business Day' END
    Modifying the Query for the nth Business Day
    To modify the above SQL for the nth business day, change the numbers in bold to the appropriate values.

  • Subtract business days from date - calculated column

    Hello,
    I had a calculated column on a library that took two dates and found the difference between them in business days, but I am not sure how to subtract business days from a date...for instance I get a start date from a form and I need to
    subtract 10 business days from that date.
    Can anyone help?

    I've always resorted to Javascript/JQuery for that kind of function. I found an old fashioned loop worked the best for me - it supports going forward or backwards. I key it off of a change in a starting date, or sometimes a status change. My actual production
    code takes into account another list where we remove holidays and non-work days.
    newDate = getNextDate(newDate, -3);
    $("input[title='Date Due']").val((newDate.getMonth() + 1) + "/" + newDate.getDate() + "/" + newDate.getFullYear());
    function getNextDate(currentDate, offset) {
    // offset is business days
    var wkend = 0;
    var index = Math.abs(offset); // need positive number for looping
    var neg = true;
    if(offset >= 0) { neg = false; }
    var curDOW = currentDate.getDay();
    var nextDate = new Date(currentDate);
    for(var i=1; i <= index; i++) {
    nextDate.setDate(nextDate.getDate() + (neg ? -1: 1));
    var nextDOW = nextDate.getDay();
    if(nextDOW == 0) {nextDate.setDate(nextDate.getDate() + (neg ? -2: 1));} // Sunday
    if(nextDOW == 6) {nextDate.setDate(nextDate.getDate() + (neg ? -1: 2)); } // Sat
    // alert("offset is " + offset + "start: " + currentDate + ", next date is " + nextDate);
    return nextDate;
    Robin

  • Baseline date calculation excluding non-Business days

    Hi,
    We have a requirement to exclude non-Business days while calculating Baseline date.
    Currently the Baseline Date being populated in the Accounting Document is Document date + 5days(including Holidays).
    For eg
    Current Scenario
    Document Date: 12th Feb 2008
    Baseline date: 17th feb 2008.
    Requirement:
    Document Date: 12th Feb 2008
    Baseline date: 19th feb 2008(Excluding Sat & Sun).
    Request you to share useful info in this regard.
    Thanks
    Binu

    Hi,
    Use user exit RV60FUS5 for these base line date calculations.
    Thanks
    Krishna.

  • Calculating Business Days in a Date Range

    I have two questions:
    1. Does anyone know a better formula for calculating business days in totals?
    I am currently using the formula in https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/701a52c3-6b1e-2b10-21b3-a6e101be1a0f
    I tailored to my needs.  However, there are still a lot of manual maintenance every year. 
    2. I have many reports that need the formula.  It is very consuming to update the formula in each report.  Does anyone know a better way to do it? 
    I use Crystal XI. 11.0.0.895.  We do have a Crystal Enterprise server hosted in another department.

    Not sure if this is any simpler but you could save this as a custom function, that way you will have to modify it once a year for the holidays.
    numbervar days;
    datevar date1 := minimum({?My Parameter});
    datevar date2 := maximum({?My Parameter});
    days := DateDiff ("d", date1, date2) -
    DateDiff ("ww", date1, date2, crSaturday) -
    DateDiff ("ww", date1, date2, crSunday);    // this will give you the number of business days
                                                        // (excluding Saturdays and Sundays) for a given date range.
    // then, for each holiday, you can enter lines like this
    if date(2008,01,01) in {?My Parameter} then days := days - 1;
    // The final tally of DAYS should give you the total business days in a date range.
    totext(days,0);
    where {?My Parameter} is the date range.

  • Need Help Calculating Business Days AND omitting Holidays...

    Post Author: dkotenoglou
    CA Forum: Formula
    Thanks to the people here I was able to get a nice formula to help me calculate the amount of business days between two days.//Crystal syntax
    Local DateTimeVar d1 := ;
    Local DateTimeVar d2 := ;
    DateDiff ("d", d1, d2) -
         DateDiff ("ww", d1, d2, crSaturday) - 
         DateDiff ("ww", d1, d2, crSunday) This works great.  I wanted to add the ability to omit US Holidays.  Now this is a straight Crystal Reports install without an SQL backend so I cannot use any formulas there.Is there a parameter? I can use to manually create a table of dates to omit?  The only reason I ask is that our company was closed during the holidays so my day reports are really high. I do not mind typing a long list of days manually (12/24/2007, 12/25/2007, etc) but I need to know how to best integrate that list into the formula.  

    Post Author: V361
    CA Forum: Formula
    If you have CR XI, there is another example as well, in the sample reports,  look at feature examples, custom functions.rpt   this code is from that example.
    Function cdDateAddSkipHolidays (nWorkingDays As Number, startDateTime As DateTime) As DateTime    'the result = startDateTime + nWorkingDays + nHolidays (including weekends)    'the algorithm below also works when nWorkingDays is negative
        Dim totalDays    'give a rough estimate for total days. For each 5 work days there are 7    'days. Also add in an extra 2 weekend days to account for a partial week.    totalDays = Fix(nWorkingDays * 7 / 5 + 1) + 2
        Dim iteratedDiff    iteratedDiff = cdDateDiffSkipHolidays (startDateTime, startDateTime + totalDays)
        If (iteratedDiff >= nWorkingDays) Then        Do While iteratedDiff >= nWorkingDays            totalDays = totalDays - 1            iteratedDiff = cdDateDiffSkipHolidays (startDateTime, startDateTime + totalDays)        Loop        cdDateAddSkipHolidays = startDateTime + totalDays + 1    Else        Do While iteratedDiff < nWorkingDays            totalDays = totalDays + 1            iteratedDiff = cdDateDiffSkipHolidays (startDateTime, startDateTime + totalDays)        Loop         cdDateAddSkipHolidays = startDateTime + totalDays    End If
    End Function

  • 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

Maybe you are looking for

  • Gif Animations

    First off, I'd like to say I've been making gif animations in Photoshop Elements since 2.0, and I've had no problem with 6.0 either--- when I was on Windows. For whatever reason, when I open a .gif animated image, I get an error message that says: "T

  • How can I set app tabs to open to the default page on startup?

    If I use an App Tab and click on a link from that tab, then exit and open Firefox, it opens up the website I was on when I closed Firefox the last time as the App Tab. For example, If I have Google as an app tab, make a search, click on a new website

  • SQ01 mass generation of quries problem

    i need a sample code or FM for mass generation of SQ01 quries.bcz aftter changing in client i have to regenerate again all quries..so i want some workaround so i can perform this task in one go. any idea?

  • Error creating Project Server 2013 Server Side Event Handlers

    Hi, I have created a WCF service and deployed it successfully.  Now when trying to add a new event receiver for Project CheckIn event, nothing happens.  Checking the service using Services panel, it shows Microsoft Project Server Events Service 2013

  • Cause for the sudden shutdown of Essbase?

    Hello Experts, One of my customer would like to know the cause for the sudden shutdown of Essbase. They started receiving the below error when tried to connect through EAS or through Spread sheet Add-in network error [145]: unable to connect to essol