Calculating Work Day Formulas

We've recently adopted BOBJ/Webi at my company and I find the software to be rather easy to use in some instances and mind-wreckingly hard in others. One roadblock myself and other users are bumping into is calculating work days. A definition of a work day in this instance would be Monday through Friday. The monkey wrench is that we would also like to subtract out holidays, such as July 4th and Thanksgiving. Then end product would be calculating out what work day the current date is and how many days it is out of so that a simple straight-line extrapolation can be made (Metric/Current Work Day)*Total Work Days. Also, what we invoice/ship is not accounted for until the following day... for example, today (2.22.10) would be the 15th workday in February out of 20 total work days.
Appreciate any and all help/assistance/counsel I can get on this.
Ryan

Hi Ryan,
If I have understood your question then I think following solution may help you.
Do you have your Universe created on the top of BW query or is it some other Database?
If it is some other database then create couple of Filter at Universe level: Such as Holidays so that you can use this one to subtract holidays:
For Example:
ucase(Calendar_year_lookup.Holiday_Flag)
ucase(Calendar_year_lookup.Holiday_Flag) = 'Y'
Then you create another Dimension for Work days that would be between Monday to Friday.
Once they are created in Universe you export Universe.
Now create a formula where you would use month minus custom dimension workdays and minus holidays to get actual work days which would be from Monday to Friday and son on.
Basically we can achieve this by using filters and formulas.
Wish you good luck.
Bashir Awan

Similar Messages

  • Working day formula that excludes weekends and holidays in WEBI

    Hi Guys,
    Can we calculate a working day formula that excludes weekends and holidays in WEBI OR in Universe?
    The universe I am working on is using stored procedures, so there are no joins or modelling done. Although there is a workday stored proc  that I can bring in the universe.
    I am just thinking if there is no modelling or joins done in the universe how will this help me in webi?
    Your suggestions will be very helpful.
    Thanks,
    Jitan

    One more suggestion I need from you  -
    I have a Work_Calendar_VW that has the following columns -
    Calendar_Date - 5/1/2014
    Calendar_Year - 2014
    Calendar_Month - 5
    Calendar_Day - 1
    Work_Day - 1
    Day_Type - WD (Work Day)  For Weekends this will be displayed as WE
    The columns have all dates for current year in SQL Server.
    I am going to pull this into the universe and create 2 derived tables to calculate MTD Day counts.
    Derived Table 1  - Calculate Yest Work Day... this will remove all the weekends and holidays and give me the last working day. This includes couple of case statments to check each day if it's a working day or weekend.
    For Work Day the above code will be 1 and for weekend 0
    Derived Table 2  - This will give me the count of working days in current month using the above view and Derived table 1 Below is the code  -
    SELECT COUNT(*)
    FROM Work_Calendar_VW
    WHERE [Work_Day] = 1 AND
       (Calendar_Date BETWEEN CAST(CONVERT(VARCHAR(25),MONTH(LastWoringkday()),101) + '/01/'
       + CONVERT(VARCHAR(25),YEAR(LastWoringkday()),101) AS DATE)
      AND LastWoringkday()).
    I cannot do joins because this universe has been built using stored proc and would like to implement this in BO universe.
    let me know if this is the right approach.
    Thanks,
    Jitan

  • Calculating work days in a function

    I have a function that will count the total number of days between two weeks. ie May 19, 2010 to June 18, 2010 is 30 total days in my cycle. We dont work on weekend so that 30 days is not correct. The formula below is how i'm calculating the days between cycles. Is there any way to not count the weekends in my cycle? Please see formula below:
    TIMESTAMPDIFF(SQL_TSI_DAY, "Release Dim"."Release Cycle Start Date", "Release Dim"."Release Cycle End Date")

    Thanks Hammett81.
    I used your formula but it's still calculating the days in my cycle as 30. My start date comes from my column "Release Dim"."Release Cycle Start Date" and my end date comes from the column "Release Dim"."Release Cycle End Date". Can you tell me why the formula below is giving me the weekends included in my count?
    Thanks a million for all your help.
    TIMESTAMPDIFF(SQL_TSI_DAY,TIMESTAMPADD( SQL_TSI_DAY, 7-DAYOFWEEK("Release Dim"."Release Cycle Start Date"),"Release Dim"."Release Cycle Start Date"),TIMESTAMPADD(SQL_TSI_DAY, 7-DAYOFWEEK("Release Dim"."Release Cycle End Date"),"Release Dim"."Release Cycle End Date"))+ CASE 7-DAYOFWEEK("Release Dim"."Release Cycle Start Date") WHEN 6 THEN 5 ELSE 7-DAYOFWEEK("Release Dim"."Release Cycle Start Date") END-CASE 7-DAYOFWEEK("Release Dim"."Release Cycle End Date") WHEN 6 THEN 5 ELSE 7-DAYOFWEEK("Release Dim"."Release Cycle End Date") END

  • Working days formula and Crystal 7 - is it possible?

    Post Author: Tim F
    CA Forum: Formula
    Hi folks,
    Really hope someone can help, I'm struggling with writing a report that needs to show the difference between two dates in working days. I've found the same formula posted here several times but cannot get it to return a logical value in my report. I'm wondering if that might be because I'm using an older version of Crystal? The formula in question is this one:
    //Main formulaWhileReadingRecords;Local DateVar Start := ({PPV_COMPLAINTSEH.DTRECD});   Local DateVar End := ({PPV_COMPLAINTSEH.ACTCMPLTD}); Local NumberVar Weeks; Local NumberVar Days; Local Numbervar Hol;DateVar Array Holidays;
    Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;Days := DayOfWeek(End) - DayOfWeek(Start) + 1 + (if DayOfWeek(Start) = 1 then -1 else 0)  + (if DayOfWeek(End) = 7 then -1 else 0);  
    Local NumberVar i;For i := 1 to Count (Holidays)do (if DayOfWeek ( Holidays[i] ) in 2 to 6 and      Holidays[i] in start to end then Hol:=Hol+1 );
    Has anyone come across an alternative way of doing this, or have any ideas why this formula is not working in my report? Any advice would be much appreciated,
    Regards,
    Tim

    Post Author: Charliy
    CA Forum: Formula
    You set up a Running Total.  Drag the filed you want Summed, Select Sum as the operation if that is not the default.
    Just below that you weill see Radio Buttons that say For Every Record, On Change of Group, On Change of Field, Use a Formula, etc - click the one that says Use a Formula.  The Blue Bos to its right will turn Red, click on it, this is where you put your formula: NOT(DATEPART('w',{table.date}) IN [6,7])
    Save that, then just decide if you want it reset on a Change of Group, or Never (Grand Total).  Give it a name and put it on your report.

  • Suggestions on calculating work days instead of Calendar days

    Hi there,
    I would like for someone to suggest how would I approach a project in calculating a date that would consider if a date is a holiday or a work day. For example: If I take current date + 7 normally it would be a week (7 days). However, if a day in that week is a holiday, then it would return the 8th day. If the 8th day falls into a weekend, then, get the next work date.
    Any ideas would be greatly appreciated.
    Thanks for your assistance in advance.

    Thanks. This give me a pretty good start. I am thinking that I need a table that store holidays (Non-work days excluding weekend). Once I load this table into memory, then I would check the first date + 7. Then compare the two dates against the array to see if there is a holiday. If there is, then I would increment the end date by 1 and validay if it is a weekend date. If it is, I would continue to incurement until it is nolonger an weekend date. Once I have that, I would check the date against the array (where I left off) and continue to validate to see if there are more holidays.
    What do you think about this approach?

  • Function for calculating working days

    Dear Oracle
    Is there any function to calculate no of working days if I pass From date & To date?.
    Thanks
    Christy.

    This would work for normal weekdays, but what about bank holidays?
    They change from country to country, so you need to create a package yourself.
    We got one that looks like the following:
    create or replace
    package body zentr_date_functions as
      function eastern (p_year in number) return date is
        -- Get easter sunday (working from 1900 to 2099)
        -- CKL 02.09.1998 nach c't 18/98
        l_a pls_integer;
        l_b pls_integer;
        l_c pls_integer;
        l_d pls_integer;
        l_e pls_integer;
        l_p pls_integer;
        function make_date(p_d in pls_integer, p_m in pls_integer, p_y in pls_integer) return date is
        begin
          return to_date(to_char(p_d, '00')||to_char(p_m, '00')||to_char(p_y, '0000'), 'DDMMYYYY');
        end;
      begin
        if p_year not between 1900 and 2099 then
          return null;
        end if;
        l_a := mod(p_year, 19);
        l_b := mod(p_year, 4);
        l_c := mod(p_year, 7);
        l_d := mod(19 * l_a + 24, 30);
        l_e := mod(2 * l_b + 4 * l_c + 6 * l_d + 5, 7);
        l_p := 22 + l_d + l_e;
        if l_p > 31 then
          if l_p = 56 and l_d = 28 and l_a > 10 then
            return make_date(18, 4, p_year);
          elsif l_p = 57 then
            return make_date(19, 4, p_year);
          else
            return make_date(l_p - 31, 4, p_year);
          end if;
        else
          return make_date(l_p, 3, p_year);
        end if;
      end eastern;
      function is_workday (p_date in date) return number as
        -- is this a working day?
        l_eastern date;
      begin
        if to_char(p_date, 'DY', 'NLS_DATE_LANGUAGE = AMERICAN') in ('SAT', 'SUN') then
          return 0;
        end if;
        if to_char(p_date, 'DDMM') in ('0101', '0105', '0310', '2412', '2512', '2612', '3112') then
          -- fixed date bank holidays in lower saxony, Germany
          return 0;
        end if;
        if to_number(to_char(p_date, 'MM')) not between 3 and 6 then
          return 1;
        end if;
        if to_number(to_char(p_date, 'YYYY')) not between 1900 and 2099 then
          -- calculation not possible
          return null;
        end if;
        l_eastern := eastern (to_number(to_char(p_date, 'YYYY')));
        if trunc(p_date) in (l_eastern - 2, l_eastern + 1, l_eastern + 39, l_eastern + 50) then
          -- good friday, easter monday, ascension day, pentecost monday
          return 0;
        end if;
        return 1;
      end is_workday;
      function workdays_between (p_date1 in date, p_date2 in date) return number as
        -- count number of working days between  p_date1 and p_date2 (incl. both)
        l_count pls_integer := 0;
      begin
        for i in 0 .. p_date2 - p_date1 loop
          l_count := l_count + is_workday(p_date1 + i);
        end loop;
        return l_count;
      end workdays_between;
    end;
    /

  • Calculation of no. of working days (per Factory Cal) between 2 date chars

    This question could be considered to be in continuation of a previous post called "Working days of month with factory calendar"
    I have two date Characteristics: say Date1 and Date2. I need to find the number of working days between them based on the factory calendar.
    (And yes we have already defined the default factory calendar in IMG under 'General Reporting settings' ).
    The previous post proposed the following:
    1) Convert date1 into factorydate (standard functionmodule)
    2) Convert date2 into factorydate (standard functionmodule)
    Perform date1 - date2 to get number of working days.
    I agree that there is a std function module to convert cal date to factory date called: 'DATE_CONVERT_TO_FACTORYDATE'
    But what are the steps for calling the conversion? Should I create a new Formula variable of 'Customer Exit type' give it a name and define the Function module in CMOD? But then how do I attach the formula variable to the date characteristic. Note that my infoobjects are Chars so I cannot do date1- date2 in the query as is possible with keyfigures!
    Please help! (my version is BW 3.0)
    Thanks
    Naresh

    Hi,
    For the above scenario when you need to calculate date 1 - date 2. we can't build a new formulae or calculated KF directly because those are the chars.
    So we need make chars to act as KF through Formulae with replacement path.
    create a formulae variable on those 2 Date chars with Processing type as replaccement then those 2 Dates can be avilable to build a formulae as ur requirement.
    Let me know if you need any more information.
    Thanks,
    Raju

  • How to set the payment Due date calculation as per working days.

    how to make changes in the vendor Payment terms so that while calculating the Payment due date as per Payment terms, system calculates it based on Working Days & not the Calender days ?
    Help is much appriciated.
    Thank you,
    Amit

    Hi,
    This is the standard settings by SAP, normally we couldn't change it to working day.
    Good luck
    Tao

  • Date calculations based on working days

    I need to add date calculations to a worksheet to show the time elapsed between two actions.
    Just a straightforward subtraction works fine, but what I really need to be able to do is calculate the number of working days between the two point (as something taking 5 days over Christmas with the 2 bank holidays is different equivalent to something taking 3 days in a normal week)
    At the moment I'm exporting the data into excel for analysis of this, but would really like to be able to do it in Disco so that the end users can go straight to the report using viewer, rather than having to do the conversion for them.
    Is this possible?
    Cheers

    Hi,
    Every thing is possible, the Q is how complicated is it....
    My suggestion is to create a table with all the dates of the non-working days for ex:
    create a table with all the MON-THURSDAYS, union to this table the holidays you know of such as christmas and so on.
    After getting this table you can create a function that returns the number of working days between 1 date to another by subtracting the days exists in this table.
    I started with that, you are more then welcome to get ahead with it and let us know what happened...
    create table holiday
    D_date date,
    d_day varchar2(20)
    create or replace procedure holiday_proc is
    d_date date;
    begin
    d_date := trunc(sysdate);
    while d_date<'01-jan-2010'
    loop
    if to_char(trunc(d_date),'Day') not in ('Saturday ','Sunday ') then
    INSERT INTO Holiday (d_date,d_day)
    (select trunc(d_date),to_char(trunc(d_date),'Day') from dual);
    end if;
    d_date := d_date+1;
    end loop;
    commit;
    end holiday_proc;

  • Calculating the planned delivery time in calendar days or working days

    Hi,
    It seems that there is a way to calculate the planned delivery time in calendar days instead of working days.
    When I use the "Planned delivery time calculation" (WPDTC), in Evaluation Options, I got the message :
    "Note that follow-on applications are currently interpreting the planned delivery time as calendar days.
    If they should be interpreting the planned delivery time as working days, you need to modify these applications. If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
    When MRP create a PR -with MDBT, MD03 or MD01- I want my Planned delivery time to be in working days.
    I can't manage to make that "If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
    I would appreciate your help.
    Thanks
    PYR

    Hi,
    I understand that it makes sense that vendors calendar has to be different (compared to my plant).
    But, I still don't understand why in the SAP help, they say "If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
    It seems that planned delivery time may follow a calendar.
    Thanks,
    PYR

  • How is lead time in working days calculated in 2LIS_05_QVUDN

    I was wondering if someone knows how lead time is being caclulated for 2LIS_05_QVUDN.  I've found the tables associated and the function module but I can't find the actual calculation
    Thanks

    Hello
    The lead time in working days works like this
    If you have 1 inspection lot for a material   -the time from  Lot creation to Usage decision given  is the lead time.
                                                              Lot created               Usage Decision made       Lead Time
    for eg Material X , inspection lot no   14/05/2008 10: 00          14/05/2008 14: 00            4 Hours
    it converts the hours in to days . =4/24= 0.16 days
    For total lead time individual lot's lead time sum is calculated
    Hope this clarifies your doubt
    Regards
    gajesh

  • Sales Order : Calcul delivery date with only working days

    HI,
    When I create sale order, the delivery date is calculed with the number of days mentionned in type of sale document. SAP add this number of days into the day's date.
    Is it possible to calculate this delivery date only with working days in the corporate calendar ???
    Thank's

    HI
    Delivery date in the Sales order will be calculated the calender only basedon the Transportation lead time and Pick/Pack time and excluding the holidays
    Please cross the same in your instance
    Regards,
    Ram.

  • Work day calculator

    Hi All, I'd like to do a function in Numbers whereby a day is considered as 8h and I can then multiply a day rate by this.
    I want to enter the data as days and hours.
    eg:
    Header 1
    Duration
    Day rate
    Header 4
    01d 4h -> (this is calculated as 1.5 days)
    $400
    $600
    01d 9h -> (automatically corrects to 2d 1hr -> 2.125)
    $400
    $850
    0d 5h -> (calculated as .625 days because 8hr day)
    $400
    $250
    any help appreciated

    I think you will add lots of complexity trying to use the duration (which can represent  Weeks Days Hours Minutes Seconds and Milliseconds)
    If you enter in hours only (just a number like, 12) not as a duration ("1d 4h" or "12h") you can computer Work Days like this.
    Assume you enter work hours in cell B2 AND
    that a work day is the same as 8 hours
    C2=B2/8

  • Calculating Number of Working Days

    Hi All,
    I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
    I'm not using procedure , Operating directly with tables.
    Any help would be appreciated.
    Regards

    Hello Pari,
    Check Exclude Holidays and weekends from Last7Day function link for function to exclude weekends.
    and How to query the number of working days between two dates to get holidays defined in holiday calander.
    Thanks,
    Neetu

  • Work day calculations

    Hi
    I want to be able to calculate the difference between two dates on my form minus weekends. Is there a way to do this?.
    I have two Date/time fields one for depart and one for arrive, and i have a numerical field which contains the difference in days.
    I have the following FormCalc code on the numerical field calculate event.
    Date2Num(form1.page4.section11.sect11Body.arrivalDate.rawValue, "YYYY-MM-DD") - Date2Num(form1.page4.section11.sect11Body.departureDate.rawValue, "YYYY-MM-DD")
    This works, but i want to know if its possible to calculate only the working days.
    For eg. Depart Thurs 12th July
    Returning Wed 18th July
    Would equate to: 6 days or 4 working days.
    I've had a look for some javascript but couldn't find anything.
    Any ideas?
    thanks

    Hello dbuchanan,<br /><br />Same as above, I have two date fields called "leaveStart" and "leaveEnd" respectively. Leave starts on the first day absent, and leave ends on the first day back at work. No scrips in any of these.<br />Then I have a numeric field called "numDays" - read only. In this field I use this JavaScript in the 'calculate' propertyy: <br /><br />// An array with this years public holidays<br />//Should probably be a bit more dynamic than this<br />var hdayar = [<br />     "2007/01/01", <br />     "2007/03/21", <br />     "2007/04/06", <br />     "2007/04/09", <br />     "2007/04/27", <br />     "2007/05/01", <br />     "2007/06/16", <br />     "2007/08/09",<br />     "2007/09/24",<br />     "2007/12/16",<br />     "2007/12/17",<br />     "2007/12/25",<br />     "2007/12/26",<br />     "2008/01/01"];<br /><br />var startBox = xfa.resolveNode("leaveStart");<br />var endBox = xfa.resolveNode("leaveEnd");<br /><br />/***Clear field at every 'calculate' event***/<br />this.rawValue = "";<br /><br />/***Leave***/<br />// Only calculate further if both the start and end dates are known<br />if ((startBox.rawValue) && (endBox.rawValue)){ <br />     var start      = util.scand("yyyy-mm-dd", startBox.rawValue);<br />     var end       = util.scand("yyyy-mm-dd", endBox.rawValue);<br />     var lsday     = start.getDay();<br />     var leday     = end.getDay();<br />     <br />     // Exit if ether start or the end date falls on a Sunday (0) or Saturday (6)<br />     if (((lsday == 0)||(lsday == 6))||((leday == 0)||(leday == 6))) {<br />     }<br />     <br />     // only calculate further if the end date after the start date     <br />     else if (end.getTime() > start.getTime()){<br /><br />          //calculate number of days<br />          var days           = end.getTime() - start.getTime();<br />          days               = Math.floor(days / (1000 * 60 * 60 *24));      //remove decimals<br />     <br />          //calculate number of weeks<br />          var modulo      = (days)%7;<br />          var fweeks      = days - modulo;<br />          var weeks      = (fweeks)/7;<br />          <br />          //calculate number of week-end days<br />          var we_days = weeks * 2;<br />          if (leday < lsday){<br />               we_days = we_days + 2<br />          }<br />          <br />          //test for public holidays<br />          var phdays = 0;<br />          for (var i = 0; i <hdayar.length; i++){<br />                    if ((Date.parse(hdayar[i]) >= Date.parse(start)) && (Date.parse(hdayar[i]) <= Date.parse(end))) {<br />                    phdays ++;<br />               }<br />          }<br />          <br />          //total workdays is days - weekends - publick holidays<br />          this.rawValue = days - we_days - phdays;<br />     }<br />}<br /><br />So now we handle weekends and holidays correctly - I think. Until someone finds the other bugs in here :-)<br /><br />Regards<br />Jan

Maybe you are looking for

  • 2012 RDS Group Policy - Adobe Reader and Acrobat to Co-exist

    I have a 2012 RDS session host that 20 users terminal in to.We have always had Adobe Reader installed for users to open PDF files.10 of the users required Adobe Acrobat Pro, so we obtained a license for 10 users to access Acrobat Pro.We installed Acr

  • Total on Count Distinct does'nt display Sum

    Hi I use Discoverer 9.0.2.39.01. In a crosstab layout, the datat point is a calculation item which perform Count_Distinct. I try to define a Grand Total (right and bottom) but I achieve no data. any advices? thanks

  • Keyboard shortcut -- f1

    I've got some code that attempts to set a keyboard shortcut for a menu item to the F1 key. Unfortunately, it's setting it to f+1. Does anyone know how to do this? Here's the code I'm using: helpPages.keyEquivalent = 'f1'; helpPages.keyEquivalentModif

  • SOA Application design

    Hi All, I want to create a SOA Suite application. Is there any analysis and design phase like J2ee application. eg: J2EE application I will use UML and OOAD concepts after requirement analysis phase. 1) What steps do I need to carry out for analysis

  • I Can't compiled forms in server 9iAS, Linux

    Good.. I have a problem, when I want to compile the "form", in linux down(under) 9iAS. There throws a mistake that does not find bookshop libigo.so.0, but if they exist inside the directory(board of directors) Lib., it is bad, because all the feasibl