Calculate number of Business Days

I need to calculate number of Business Days in BODS. Lets say I have One source table and One Date Dimension table to identify Business Day and need to calculate the no of working days and load in to FACT table (Like in screenshot below)?
By adding Query transform, I can calculate no of Days, but how to calculate working days between ORDER_RECEIVED_DATE and ORDER_SHIPPED_DATE.
SQL: select count(*) from DIM_DATE  where DATE between ORDER_RECEIVED_DATE and ORDER_SHIPPED_DATE and HOLIDAY_FLAG='NO'

Prashanth Chinta,
I have simulated this Job in my repository and and below are the steps by step implementation.
Your Dataflow will look like below. It contains the source and Target table with expected results. Hope this is what you are looking for.
DIM_DATE table contains all the dates in a year and mark each date either Holiday as 'YES' or 'NO'
Qry_Total_Ship_Days Query Transform
Qry_Join Query Transform
Qry_Filter_Holidays Query Transform
Qry_Cnt_Holidays Query Transform
Qry_Cnt_Holidays Query Transform (This is to show the groupby columns)
Qry_Cal_Ship_Days Query Transform

Similar Messages

  • Calculate: SYSDATE + TWO BUSINESS DAYS

    Is there a simple way (function) in 10g to calculate
    - "SYSDATE + TWO BUSINESS DAYS (not including Saturday)"
    - "SYSDATE + TWO BUSINESS DAYS (including Saturday)"
    in SQL ? Or I have to write a function to calculate manually?
    Thank you for any idea.

    One possible solution, based on a table of holidays:
    CREATE TABLE HOLIDAY_TABLE
    (HOLIDAY_DATE DATE PRIMARY KEY,
    DESCRIPTION VARCHAR2(50));
    SELECT dt
      FROM (SELECT dt, RANK () OVER (ORDER BY dt) pos
              FROM (SELECT     TRUNC (SYSDATE) + LEVEL dt,
                               CASE
                                  WHEN TRIM (TO_CHAR (SYSDATE + LEVEL, 'DAY')) = 'SATURDAY'
                                   OR TRIM (TO_CHAR (SYSDATE + LEVEL, 'DAY')) = 'SUNDAY'
                                  THEN 0
                                  ELSE 1
                               END cnt
                          FROM DUAL
                    CONNECT BY LEVEL < 7)      -- number large enough to generate a complete list of possible days
             WHERE cnt = 1 AND (SELECT COUNT (*)
                                  FROM holiday_table
                                 WHERE holiday_date = dt) = 0)
    WHERE pos = 2  -- number of working days to add Miguel

  • Add number of business days to date field

    Hello, I noticed that there is not much discussion in the forum surrounding u201Cbusiness daysu201D so I hope this post/discussion/solution contributes to the content of this forum.
    I am using the following 3 formulas to try to Add number of business days (based upon a table field) to a specified date:
    1. Variable name = SetVar
    //Set Variable for Add Business Days:
    DateVar Array Holidays;
    DateVar Target:= CDate({TMS_MOVEMENT_EVT.EVT_DATE}); // Put your field name in here
    NumberVar Add:=  {DTCI_DOD_TRANS.TRANS}; // put the number of days here to add (a positive number)
    NumberVar Added := (0);
    2. Variable name = AddBizDays
    //Adding Business Days:
    EvaluateAfter({@SetVar});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
    Target
    3. Variable name = HOLIDAYS
    //Holiday Array Formula for the report Header:
    BeforeReadingRecords;
    DateVar Array Holidays := [
    Date (2003,12,25),   // you can put in as many lines for holidays as you want. 
    Date (2003,12,31)
    0
    I am successfully getting my data needed to make the necessary calculations and variable assignmentsu2026 I believe that my ISSUE is that I am not sure where to place these formulas into my report so they assign the variables and execute properly when previewing my report. I am curious if that is my issue, and if so, can someone provide me direction on where to put each of these formulas in my report.
    Currently, when I try to preview the report, I get the following Crystal Reports Error:  -u201CA number, currency amount, Boolean, date, time, date-time, or string is expected here.u201D
    Then Crystal automatically opens the AddBizDays formula and highlights the word added, see below RE: u201CWHILE Addedu201D
    For reference, my report has 3 groups, and I am displaying all of my output information (and locating my formulas) in the group footer #3 report section. I have moved them around to other report sections/groups/placements, but to no success.
    Thanks so much.
    Best, Matt

    I worked this out... FYI - for the benefit of all forum users:
    ADDING BUSINESS DAYS TO A CERTAIN DATE (excluding weekends and holidays)
    1. Variable name = AddBizDays
    //Adding Business Days:
    WhileReadingRecords;
    DateVar Array Holidays;
    DateVar Target:= CDate(); // Put your field name in here
    NumberVar Add:=  ; // put the number of days here to add (a positive number)
    NumberVar Added := (0);
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
    Target
    2. Variable name = HOLIDAYS
    //Holiday Array Formula for the report Header:
    BeforeReadingRecords;
    DateVar Array Holidays := [
    Date (2003,12,25), // you can put in as many lines for holidays as you want.
    Date (2003,12,31)
    0
    ...too bad i don't get forum points for sharing this solution.
    Special thanks to KenHamady.com -- for sharing this solution.
    Sincerely,
    Matt

  • FM to calculate Number of working days adjusted for an employee -ABAP HR

    I have one requirement in which i have to Calculate "Number of working days adjusted" for an employee for a disability program.
    In this context i wanna know, if just get difference between two dates (i.e the duration for which employee was compensated ) based on Holiday calender...Will this give give me "Number of working days adjusted"  for an employee or i have to consider work schedule for an employee? If yes , Then please let me know sm FM to calculate number of working days between two dates speific to an employee.

    check
    HR_PERSONAL_WORK_SCHEDULE
    HR_GET_QUOTA_DATA

  • Number of business days (excluding holidays) ?

    Hi All,
    What is the SQL query to find number of business days (excluding holidays) between 2 given dates ?
    List of Holidays will be maintained as a separate table.
    I need a SQL query rather than a stored procedure or function.
    I am using oracle 9i.
    Thanks in advance.

    Does this thread help?
    Need to find number of business days - query pls

  • Calculate number of working days in a month

    Hi All,
    I am trying to build a report to calculate the performance of a sales rep for the current month. This report has to exclude the holidays (saturday, sunday and one extra day in each month) in order get the exact performance. Could anyone suggest me on how to go about writing a Case statement which would get me the number of working days in a month excluding holidays.
    Thanks

    Hi,
    There are no direct oracle function that could be used to get the desired results.
    However you could try using something like
    SELECT COUNT( *)
    FROM
    (SELECT ROWNUM RNUM
    FROM ALL_OBJECTS
    WHERE ROWNUM <= TO_DATE('&1') - TO_DATE('&2') + 1
    WHERE TO_CHAR(TO_DATE('&2') + RNUM - 1, 'DY') NOT IN('SAT', 'SUN');
    Give the two date ranges that you want to look for with the highiest one first. i.e say for example - 01-FEB-2011 to 31-DEC-2010 would give the working days in JAN. However note that you might have to check for holidays related to that country/region (which could be added as a seperate table).
    If you need to get an extra day in addition to the weekends, please give the dates accordingly
    SQL> SELECT COUNT( *)
    2 FROM
    3 (SELECT ROWNUM RNUM
    4 FROM ALL_OBJECTS
    5 WHERE ROWNUM <= TO_DATE('01-FEB-2011') - TO_DATE('01-JAN-2011') + 1
    6 )
    7 WHERE TO_CHAR(TO_DATE('01-JAN-2011') + RNUM - 1, 'DY') NOT IN('SAT', 'SUN');
    COUNT(*)
    22

  • How to calculate number of working days in current month?

    hi gurus,
    In a customer exit I am trying to check if the system date is the 3rd business day of the current month.  Is there any FM module that i can use?
    thanks in advance...

    Use this Function module WDKAL_DATE_ADD_FKDAYS.

  • How to calculate number of working days

    Hi experts,
    I need to determine the number of working days from two given dates. Below is my example.
    1. Posting Date
    2. Clearing Date
    3. Processing Time in Days
    The formula is:
    Processing Time in Days = Posting Date - Clearing Date
    However, the above result should exclude non-working days such as Public Holidays, Saturdays and Sundays.
    This is to be done in my Transfer Rule.
    Can someone help me with this.
    Points will be assigned as usual.
    Thanks!

    Hi,
    With referece to  Florin Wach Reply in the following link:
    Re: FM to get number of working days in a date range for a calender
    Use the update rule(routine) for <i>Processing Time in Days</i> as below:
      DATA: date_begin         TYPE sy-datum,
             date_end           TYPE sy-datum,
             current_date       TYPE sy-datum,
             working_indicator  TYPE SCAL-INDICATOR,
             workdays           TYPE I,
             factory_calendar   TYPE SCAL-FCALID.
       date_begin       = DATA_PACKAGE-PSTNG_DATE.
       date_end         = DATA_PACKAGE-CLEAR_DATE.
       factory_calendar = '01'.
       current_date = date_begin.
       DO.
          IF current_date > date_end.
             EXIT.
          ENDIF.
         CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
              EXPORTING  DATE                 = current_date
                         FACTORY_CALENDAR_ID  = factory_calendar
              IMPORTING
                         WORKINGDAY_INDICATOR = working_indicator
              EXCEPTIONS
                   CALENDAR_BUFFER_NOT_LOADABLE = 1
                   CORRECT_OPTION_INVALID       = 2
                   DATE_AFTER_RANGE             = 3
                   DATE_BEFORE_RANGE            = 4
                   DATE_INVALID                 = 5
                   FACTORY_CALENDAR_NOT_FOUND   = 6
                   OTHERS                       = 7.
         IF SY-SUBRC <> 0.
            workdays = 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            EXIT.
         ENDIF.
         IF working_indicator IS INITIAL.
            ADD 1 TO workdays.
         ENDIF.
         ADD 1 TO current_date.
      ENDDO.   
    Result  = workdays.
    With rgds,
    Anil Kumar Sharma .P

  • Need to calculate number of work days.

    Hi Experts,
    I have scenario here to calculate the number days between the service request creation date and current date. Since i have the creation date in my cube ( cube is loaded using delta update) , i use formula variable to calculate the difference. But i want to exclude Sunday, Saturday and public holidays.
    How can I achive this?
    Putting a code in the update rule will help only if we do full update everyday. A delta update will do the calc only once and whenever the base records changes..
    So is there any other way i can do this?
    Please reply.
    DV
    null

    Hi Anuradha,
    Hope you haven't understood my issue right.. I will give an eg here.
    Lets say we have three new records in base ODS1
    [Rec No]  [CreatedOnDate(in dd/mm/yyyy)]
    (1)            ( 06/06/2007)
    (2)            (11/06/2007)
    (3)             (15/06/2007)
    Assume these are new records that came into ODS1.
    Now when we load this into Cube1 from ODS1 with assumption that update between cube1 and ODS1 has a code to calculate the workdays excluding weekends and public holidays. And update method os delta ran yesterday 26/06/2007
    So now in the cube1 after yesterdays delta data will look like
    [Rec No]  [CreatedOnDate]    [No of days]   [Days w/o weekends/public holidays]
    (1)             (06/06/2007)           (20)                         (14)
    (2)             (11/06/2007)           (15)                           (11)
    (3)             (15/06/2007)           (11)                           (07)
    So in the cube if the base records 1, 2 and 3 in ODS1 doesnot  chnage the cube after todays delta will have the same value instead of a increment of 1 day in third and fourth column.
    Hope I have made my issue clear to all..
    DV
    null

  • 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.

  • How to calculate previous business day

    Hi,
    I'm stuck with an issue.
    Task is to calculate 1 to 6 previous business days with reference to system date.
    Conditions are : Week is 6 day. In first case its Sunday as weekend holiday and in second case its Saturday as weekend holiday.
    Another condition is I have to take care of bank holidays also which are stored in a separate table in database.
    How to implement this logic ?
    Below I have implemented some logic but its not running correctly for some dates adjusted according to bank holidays.
    In this code I'm taking Sunday as weekend off and To_Date is having the list of bank holidays for 2012.
    SELECT
      CASE
        WHEN TRUNC(SYSDATE-1) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
        THEN (
          CASE
            WHEN TRUNC(SYSDATE-2) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
            Then (
            CASE
            WHEN TRUNC(SYSDATE-3) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
            Then (
            CASE
            WHEN TRUNC(SYSDATE-4) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
            Then (       
            CASE
            WHEN TRUNC(SYSDATE-5) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
            Then (       
            CASE
            WHEN TRUNC(SYSDATE-6) IN (TO_DATE('01-JAN-2012'), TO_DATE('02-JAN-2012'), TO_DATE('07-APR-2012'), TO_DATE('09-APR-2012'), TO_DATE('07-MAY-2012'), TO_DATE('04-JUN-2012'), TO_DATE('05-JUN-2012'), TO_DATE('27-AUG-2012'), TO_DATE('25-DEC-2012'), TO_DATE('26-DEC-2012'))
            THEN DECODE(TO_CHAR((SYSDATE-6),'DAY'),'MONDAY   ',TRUNC((SYSDATE-6)-7),'TUESDAY  ',TRUNC((SYSDATE-6) - 7),'WEDNESDAY',TRUNC((SYSDATE-6) - 7),'THURSDAY ',TRUNC((SYSDATE-6) - 7),'FRIDAY   ',TRUNC((SYSDATE-6) - 7),'SATURDAY ',TRUNC((SYSDATE-6) - 7),'SUNDAY   ',TRUNC((SYSDATE-6) - 6))
            ELSE DECODE(TO_CHAR((SYSDATE-5),'DAY'),'MONDAY   ',TRUNC((SYSDATE-5)-7),'TUESDAY  ',TRUNC((SYSDATE-5) - 7),'WEDNESDAY',TRUNC((SYSDATE-5) - 7),'THURSDAY ',TRUNC((SYSDATE-5) - 7),'FRIDAY   ',TRUNC((SYSDATE-5) - 7),'SATURDAY ',TRUNC((SYSDATE-5) - 7),'SUNDAY   ',TRUNC((SYSDATE-5) - 6))
            END)
            ELSE DECODE(TO_CHAR((SYSDATE-4),'DAY'),'MONDAY   ',TRUNC((SYSDATE-4)-7),'TUESDAY  ',TRUNC((SYSDATE-4) - 7),'WEDNESDAY',TRUNC((SYSDATE-4) - 7),'THURSDAY ',TRUNC((SYSDATE-4) - 7),'FRIDAY   ',TRUNC((SYSDATE-4) - 7),'SATURDAY ',TRUNC((SYSDATE-4) - 7),'SUNDAY   ',TRUNC((SYSDATE-4) - 6))
            END)
            ELSE DECODE(TO_CHAR((SYSDATE-3),'DAY'),'MONDAY   ',TRUNC((SYSDATE-3)-7),'TUESDAY  ',TRUNC((SYSDATE-3) - 7),'WEDNESDAY',TRUNC((SYSDATE-3) - 7),'THURSDAY ',TRUNC((SYSDATE-3) - 7),'FRIDAY   ',TRUNC((SYSDATE-3) - 7),'SATURDAY ',TRUNC((SYSDATE-3) - 7),'SUNDAY   ',TRUNC((SYSDATE-3) - 6))
            END)
            ELSE DECODE(TO_CHAR((SYSDATE-2),'DAY'),'MONDAY   ',TRUNC((SYSDATE-2)-7),'TUESDAY  ',TRUNC((SYSDATE-2) - 7),'WEDNESDAY',TRUNC((SYSDATE-2) - 7),'THURSDAY ',TRUNC((SYSDATE-2) - 7),'FRIDAY   ',TRUNC((SYSDATE-2) - 7),'SATURDAY ',TRUNC((SYSDATE-2) - 7),'SUNDAY   ',TRUNC((SYSDATE-2) - 6))
          END )
              ELSE DECODE(TO_CHAR((SYSDATE-1),'DAY'),'MONDAY   ',TRUNC((SYSDATE-1)-7),'TUESDAY  ',TRUNC((SYSDATE-1) - 7),'WEDNESDAY',TRUNC((SYSDATE-1) - 7),'THURSDAY ',TRUNC((SYSDATE-1) - 7),'FRIDAY   ',TRUNC((SYSDATE-1) - 7),'SATURDAY ',TRUNC((SYSDATE-1) - 7),'SUNDAY   ',TRUNC((SYSDATE-1) - 6))
          END)
        ELSE DECODE(TO_CHAR((SYSDATE),'DAY'),'MONDAY   ',TRUNC((SYSDATE)-7),'TUESDAY  ',TRUNC((SYSDATE) - 7),'WEDNESDAY',TRUNC((SYSDATE) - 7),'THURSDAY ',TRUNC((SYSDATE) - 7),'FRIDAY   ',TRUNC((SYSDATE) - 7),'SATURDAY ',TRUNC((SYSDATE) - 7),'SUNDAY   ',TRUNC((SYSDATE) - 6))
      END
    FROM DUAL;Edited by: user9082359 on Oct 21, 2012 8:55 PM

    Hello,
    There are two business streams.
    For one stream,Saturday is holiday and for other Sunday is holiday and
    ('01-JAN-2012'), ('02-JAN-2012'), ('07-APR-2012'), ('09-APR-2012'), ('07-MAY-2012'), ('04-JUN-2012'), ('05-JUN-2012'), ('27-AUG-2012'), ('25-DEC-2012'), ('26-DEC-2012') is my list of bank holidays for 2012 year.
    Now if suppose we have to calculate 1 previous business day for today 22 Oct,it would be 20 Oct for one stream and 21 Oct for another stream.
    Like this I have to calculate 1-6 previous business days for sysdate.
    Now If there is a bank holiday coming in between e.g. suppose 20 Oct is a bank holiday and Sunday is weekend holiday,so now 1 previous business day would be 19 Oct.
    I hope I have made myself clear.
    Thanks and waiting for solution of this issue.

  • 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)

  • Help with expression for business days

    Dear Frends,
    I need help with business days expression.
    The report is for call center operation. Whenever a user calls in and opens an issue it is recorded as a case. And each case is associated with create time and valueofone(which is always one).
    My report contains 'case type' as the first column, and rest of the columns are age buckets(col1: 0-5 days, col2: 6-10 days). By saying agebuckets I mean number of days between create date and current date. All the cases that are less than 5 days older will go to first column and similarly all the cases that are 6-10 days old will go to the second column and so on.
    In a normal case I use the following case statement: case when daysbetween(current_date, create_date) between x1 and x2 then count(valueofone) else null end
    But I need to calculate only the business days as age, so I need an expression look something like this: case when (_days_between(current_date, create_date)-no of holidays) between x1 and x2 then count(valueofone) else null end
    Note: My calendar table has a column 'Business Day' which assigns 'Y' to Business day and 'N' to holiday.
    Any help with this expression or any suitable way.
    Regards
    Chilla

    If you have a calendar table, wouldn't your function be just
    CREATE FUNCTION business_days_between( p_day1 IN DATE, p_day2 IN DATE )
      RETURN NUMBER
    IS
      l_cnt NUMBER;
    BEGIN
      SELECT COUNT(*)
        INTO l_cnt
        FROM calendar_table ct
       WHERE ct.business_day = 'Y'
         AND ct.<<date column>> >= trunc(p_day1)
         AND ct.<<date column>> < trunc(p_day2);
      RETURN l_cnt;
    END;Basially, count the number of rows in your calendar table that are business days between the two dates.
    Justin

  • Number of working days in customer exit?

    Hi, this is actually an extension to the following thread.
    How to calculate number of working days
    I have very similar requirement. Determine the number of working days (excluding weekends and holidays) from 2 given dates. But the <b>difference here</b> is that, one of the date in the calculation is the<b> current date.</b>
    1: Creation Date - this is present as infoobject in the ODS.
    2: Current Date - this is 'today''s date.
    And, No. of Working days(Zworkdays)  = Current Date - Creation Date.
    So, as mentioned in the thread 305257 speaks about including the logic in the update rules, I can use system variable sy-datum to get the current date in update routine. But if the load is not scheduled for every day (say,once in 2 days), then when i report this infoobject Zworkdays on Day2, then it will hold Day1 calc rite?
    PLease correct me if I am wrong.
    Could you please help me with other approachs I can follow. One I can think is Customer Exit in Bex for the same.... but I am not sure how to do the same (i am new to Bex and Customer exit). Could any one of you please guide me how to achieve the same. I Have 0CalDate in the ODS also. 
    Any other ideas/inputs is greatly appreciated.
    Thanks in advance
    Ramya

    Hi,
    search for virtual key figures.
    Rgds.
    Juergen
    P.S. Thanks for assigning points
    Message was edited by:
            Jürgen Hemelt

  • 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.

Maybe you are looking for