Calculating total of days

Hi Everyone,
I have 2 date items:
p9_begin and p9_end
I want to show all the sundays between these two days and also the total of sundays.
I also want to show the total of days minus the sundays.
I can't seem to think of a solution to do this. I tried to loop, but it doesn't seem to work correct.
Does anyone have a suggestion?
Regards,
Diana

Hi Diana,
You could do something like:
WITH X AS (SELECT TO_DATE(:DATE1,'DD/MM/YYYY') + LEVEL - 1 THE_DATE FROM DUAL CONNECT BY TO_DATE(:DATE1,'DD/MM/YYYY') + LEVEL - 1 < TO_DATE(:DATE2,'DD/MM/YYYY'))
SELECT (SELECT COUNT(*) FROM X WHERE TO_CHAR(THE_DATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'SUN') SUNDAYS,
(SELECT COUNT(*) FROM X WHERE TO_CHAR(THE_DATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') <> 'SUN') OTHERDAYS
FROM DUALwhich would give you your Sundays/non-Sundays. Or,
WITH X AS (SELECT TO_DATE(:DATE1,'DD/MM/YYYY') + LEVEL - 1 THE_DATE FROM DUAL CONNECT BY TO_DATE(:DATE1,'DD/MM/YYYY') + LEVEL - 1 < TO_DATE(:DATE2,'DD/MM/YYYY'))
SELECT THE_DATE FROM Xwould give you all of the dates.
:DATE1 is whatever item contains your "From date" and :DATE2 is your "To date"
Andy

Similar Messages

  • Create a table calculating amount of days in InfoPath form

    Hello,
    I am creating an InfoPath form and I want to have a table that will calculate the days needed to complete a project, it will allow the user to enter start dates and end dates and as that happens one row will have the calculated length of days it will take
    to complete based on use input and it would be real-time so no need to manually press a button to update.
    Here is my table for example:
    The first row will be the row that has the Total project time with the start time and end time based on user input.
    Is this something that can be done in InfoPath without any code? I am unable to use code so unfortunately that isn't an option.

    Hi compuluv,
    Based on your description, my understanding is that you want to Calculate the length between two date picker controls in InfoPath using rules and formulas - no code!
    Use rules, conditions, and the number(), floor(), and
    substring()   functions in formulas to calculate the difference between two date picker controls in InfoPath.
    Here is an article about it, you can use as a reference:
    http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • What are the Calculations of Compression days in MRP?

    Hi,
    Can anyone please explain me with example that what are the calculations for compression days calculated for planned orders?? I am using MRP planning.
    Thanks and Regards
    Farhan

    HI,
    compression days are the days by which lead time of your buy items gets compressed to fulfill the demand due dates.
    For ex,  Finished Good is having Due date ( as scheduled ship date/request date in SO)   on 15th of Feb, but the buy item used in this assembly has lead time of 20 days.
    Consider the plan is running today i.e. on 6th Feb, so buy item will be actually available  on 6+20=26th of  Feb,
    But your demand due date is 15th Feb, which needs to be met, so planning engine will suggest an exception for this buy item as 'Item with compression days'
    by compressing its lead time as 26th Feb-15th Feb=11days as compression days.
    Please mark this post as correct or helpful it serves your purpose.
    Thanks,
    Avinash

  • Adhoc query - Total payroll day issue on infotype 2001

    Dear Expert,
    I am working on the adhoc query and would like to generate the total number of payroll days taken by a particular employee.
    E.g. Employee A has 4 leave record in Nov 2011
    14-Nov, 16, Nov, 23 Nov, 25 Nov
    When I select the reporting period between 1-Nov-2011 to 30-Nov-2011, the total payroll days generated by the adhoc query is only 1. I am not sure why. Please help
    Best Regards,
    WF

    Hi,
    Might be remaining days are Non working days/Weekly offs/ Holidays falls..
    You Better Check through PA30 Overview of Absence records, Whether the Days are deducted from Quota or not.
    Need to check absence class in V_554s_0

  • I am using a PC with window 7 and adobe photoshop 12. I have followed Photoshop Elements Help and I still have the same problem. When I try to backup Photoshop 12 it has stop on7% when calculating Total Media size. What can I do?

    I am using a PC with window 7 and adobe photoshop 12. I have followed Photoshop Elements Help and I still have the same problem. When I try to backup Photoshop 12 it has stop on7% when calculating Total Media size. What can I do?

    Hi Prabhuram and falez,
    This issue appears where there are any inconsistencies in your catalog (generally for video files). This issue may be due to offline files, missing files, video scenes. The recommendation here would be to fix these inconsistencies and try again. If that doesn't solve the issue, please follow steps mentioned in email by me.
    ~Surendra

  • Calculating total memory in oracle RAC environment

    I have to calculate total memry in RAC environment.
    For shared and buffer pool I execute show sga.
    For UGA and PGA I execute statement that have two different values.
    This is my two different methot for calculating total memory in oracle RAC environment.
    Why I have very different value in this 2 statements on pga values?
    first stat
    with vs as
    select 'PGA: ' pid
    ,iid
    ,session_pga_memory + session_uga_memory bytes
    from (select inst_id iid
    ,(select ss.value
    from gv$sesstat ss
    where ss.sid = s.sid
    and ss.inst_id = s.inst_id
    and ss.statistic# = 20) session_pga_memory
    ,(select ss.value
    from gv$sesstat ss
    where ss.sid = s.sid
    and ss.inst_id = s.inst_id
    and ss.statistic# = 15) session_uga_memory
    from gv$session s)
    union all
    select 'SGA: ' || name pid
    ,s.inst_id iid
    ,value bytes
    from gv$sga s
    select distinct iid, pid, sum(bytes) over (partition by iid, pid) bytes from vs
    IID PID BYTES
    1 PGA: 196764792 <=====
    1 SGA: Database Buffers 318767104
    1 SGA: Fixed Size 733688
    1 SGA: Redo Buffers 811008
    1 SGA: Variable Size 335544320
    2 PGA: 77159560 <=====
    2 SGA: Database Buffers 318767104
    2 SGA: Fixed Size 733688
    2 SGA: Redo Buffers 811008
    2 SGA: Variable Size 335544320
    second stat
    with vs as
    select 'PGA: ' pid
    ,p.inst_id iid
    ,p.pga_alloc_mem bytes
    from gv$session s
    ,gv$sesstat pcur
    ,gv$process p
    where pcur.statistic# in ( 20 -- = session pga memory
    ,15 -- = session uga memory
    and s.paddr = p.addr
    and pcur.sid = s.sid
    and pcur.INST_ID = s.INST_ID
    and pcur.INST_ID = p.INST_ID
    union all
    select 'SGA: ' || name pid
    ,s.inst_id iid
    ,value bytes
    from gv$sga s
    select distinct iid, pid, sum(bytes) over (partition by iid, pid) bytes from vs
    IID PID BYTES
    1 PGA: 342558636 <=====
    1 SGA: Database Buffers 318767104
    1 SGA: Fixed Size 733688
    1 SGA: Redo Buffers 811008
    1 SGA: Variable Size 335544320
    2 PGA: 186091416 <=====
    2 SGA: Database Buffers 318767104
    2 SGA: Fixed Size 733688
    2 SGA: Redo Buffers 811008
    2 SGA: Variable Size 335544320

    I'm sorry but it is not clear to me.
    - From v$session (1th stmt) I have
    nearly 196MB of PGA mem on instance 1
    and
    nearly 77MB of PGA mem on instance 2
    - From v$process (2th stmt) I have
    nearly 342MB of PGA mem on instance 1
    and
    nearly 186MB of PGA mem on instance 2
    then...
    342+186 - 196+77 = nearly 255MB of memory allocated by oracle processes but free?
    if I want calculate the total thing of the amount of the allocated memory from Oracle...It is more correct 2th statement that query v$process...it is true?

  • Calculating Total Ending Inventory

    Hello BW Gurus,
    I have a reporting question for you. Please reply back as soon as possible as I am nearing the deadline.
    The scenario is as below:
    I need to calculate the Total Ending Inventory and the formula is as below:
    Total Ending Inventory = ‘A’ – ‘B’ – ‘C’ + ‘D’ + Last Period ‘Total Ending Inventory’
    How would I calculate the Last Period ‘Total Ending Inventory’? Total Ending Inventory is just a Calculation and is stored no where in BW.  Since I am running the report for the first time this month, Last period 'Total Ending Inventory' would be Zero for the current month. But current month's Total Ending Inventory would become next month's Last Period Total Ending Inventory. To acheive this, I need to store the Calculated Total Ending Inventory somewhere in BW so that I can pull this information when I am calculating next month's Total Ending Inventory.
    Please let me know the solution and the steps involved as soon as possible.
    Thank you very much in advance.
    Best Regards,
    Rajiv.

    Hi Anil,
    Thanks for your reply. The problem here is Total Ending Inventory is not a KF that is stored in a Cube. It is a calculated Key Figure. When I am calculating Total Ending Inventory I need to add last period's Total Ending Inventory to the calculation. Any idea on how to achieve this?
    Thanks in advance.
    Best REgards,
    Rajiv.

  • Total Replenishment days change at plant level - Materials to be automatically updated

    Hi All,
    Customer has raised a new requirement stating that they want to update the Total replenishment days plant wise, based upon this maintenance automatically all the compounds should be updated.
    Existing System:
    Right now they are maintaining the total replenishment days at material master level, based on this the ATP check happens.
    New Requirement:
    My thought is to accommodate this requirement is through developing the BDC in such a way that the plant and no of replenishment days will be updated in the spreadsheet and the BDC will update the Material master.
    Please let me know if there is any other best solution or easy way to accommodate this requirement.

    ""LSMW does not work in my case, since customer does not want to upload the material and update it. They want to update based on the Plant that in turn should update the material"""
    Have you tried this requirement by taking MM02 as recording transaction code and even you can record with Organisation levels like Plant in LSMW..
    Pl update.
    Phanikumar

  • Calculating Totals for a column in ALV Grid Display

    Hi All,
      I frustrated with the problem of simple calculating total for a column. I wrote the following code:
      LW_CATALOG-TABNAME   = P_GV_STRUCT.
      LW_CATALOG-FIELDNAME = 'ZSUMMS'.
      LW_CATALOG-DO_SUM    = GC_X.
      APPEND LW_CATALOG TO G_FIELDCAT_TAB.
      CLEAR LW_CATALOG.
    It is not working. Could you please suggest the solution?
    It would be great help to me.
    Advanced Thanks,
    Phani Kumar

    Phani,
    Did u try playing around with any of these layout fields ?
    no_sumchoice(1),       " no choice for summing up
    no_totalline(1),       " no total line
    no_subchoice(1),       " no choice for subtotals
    no_subtotals(1),       " no subtotals possible
    no_unit_splitting  " no sep. tot.lines by inh.units
    totals_before_items,   " diplay totals before the items
    totals_only(1),        " show only totals
    totals_text(60) ,      " text for 1st col. in total line
    subtotals_text(60) ,    " text for 1st col. in subtotals
    b. Addtionally... not a solution.. but u know...
    just try the same code iwth reuse_alv_list_display and see if the total gets displayed properly ?

  • Organizer 12 backup stops while calculating Total Media Size

    I have not successfully completed a backup with PS Organizer 12.  It stalls at 16 or 17 % calculating Total Media Size.  My Photo folders are about 180 GB.  I have 287GB free on my data drive.  My Apps drive is a 100GB SSD  with 36GB free.  When Backing up I am given the choice for full backup of the partial.  I chose full.  It does not ask for a folder.  Do not know why.  I transferred my photo folders from my previous PC, then transferred my USER PSE files and all worked fine, all attributes were transferred.  In addition I have optimized my catalog; cleaned the thumbnail CACHE by changing the .dat files to .old and restarting; set my Registry for maximum file size in Organizer to 1.5GB, my largest file size is 1.2GB;
    deleted files from the Catalog larger than 50MB and all files and imported them back in.  The Adobe help has help topics of either Back up your catalog to an external hard drive or Back up your catalog to a CD or DVD (Windows Only).  They do not mention a thing about backing up onto your PC, they do not say you cannot.  Well, oh, I have 8GB RAM and an Intel Core i7.  Suggestions appreciated.

    I identified the problem as to why PSE 12 Organizer was freezing during backup procedures.  The problem of freezing during backup calculation of the file size is caused by the existence of *.MOV file types.  Both my Nikon camera and my Kodak digital cameras save video recordings in *.MOV file formats.  This is likely a rare case, as only users who have Kodak or Nikon Cameras would be affected.
    I had to select, filter, all files with *.MOV formats and delete them from my catalog.  After the catalog was backed up successfully on my hard drive, same drive, different folder, I had to drag and drop the videos to get them back into the catalog.  All tags and locations and people were lost.  I could not search them and import from folder.  So the catalog is backed up successfully.  This is likely a rare case, as only users who have Kodak or Nikon Cameras would be affected.
    Case Solved.
    Elements 12 backup failPhotoshop ElementsProblem with backing up catalog in Elements Organizer 12 - help please@

  • When I try to backup my catlaog the program locks up at "Calculating Total Media Size" 33%?

    When I try to backup my catlaog the program locks up during the "Calculating Total Media Size" process at 33%?

    I have seen this before and it is probably a bad video. There is no great solution. To determine if this is the cause I would remove all your videos from PSE and try to do a backup, if the backup works, one of the videos is bad. It is trial and error to determine which video. When you remove your videos from PSE make a note as to where you have put them so you can reload them..

  • When I try to backup my files from photoshop elements 12 the "calculating total media size" box will only get as far as 46% and then freeze, how can I make it go to 100%

    When I try to backup my files from photoshop elements 12 the "calculating total media size" box will only get as far as 46% and then freeze, how can I make it go to 100%

    hi barbara
    thank you for your response, i appreciate it.  there's definitely nothing wrong with the mouse or trackpad, both work fine in every other application....i can also easily change size dimensions in other programs on my computer so it doesn't seem to be that either.  it seems like there is something weird going on in the way that pse and my mac are interacting with each other, just wish i knew what it was.    thank you again, wish me luck!

  • Interest calculating for 364 days in year

    hi
    i am calculating interest for 1 april to 31 march for the previous year but instead of taking 365 days it is calculating for 364 days. can you tell that what i have to do to correct it.
    Thanks

    Hi You can see in the payment terms you mentioned as one day due to this it will calculate the interest only 364 days.
    If the payment terms are correct then while running the interest( f.4b or f.2b etc.) there select the layout as open items include postings and select calculate the ineterest on net due dates then it will work properly
    If you have still doubt let me know

  • Redisplay calculated total

    Hi,
    I need some help.
    I have a simple 'query/single selection result' page. You select a row and go to a 2nd page where you can make changes to the details.
    One of the changes you can make is a quantity attribute which is part of an EO/VO. If quantity changes, the total amount is re-calculated and updated on a different VO. Total amount is a transient field of a VO without EO.
    The problem is I can't seem to redisplay this new calculated total when the 'apply' button is pressed even though I've updated the VO with the new value. It still shows the old value and I have to go back to the query page and redisplay to see the new value.
    I've tried the following but nothing is working:
    pageContext.setForwardURLToCurrentPage (playing with retain AM)
    ClearCache
    pageContext.putParameter(totalAmount)
    Any help or ideas is greatly appreciated.

    pageContext.putParameter(name,value) worked. I just had the wrong name.
    Thanks for your time.

  • Calculating Total Hours

    Has anyone had any experience calculating hours for a work schedule in numbers? I would like to figure out how to calculate total hours worked for a week on a work schedule. I am struggling to find the best way to do so. I would like to not have to use military time. What is the best way to add up the total time worked when I'm inputting the time as 7a to 5p (star time and end time in different columns). I need to have the columns formatted for time and date so it can be viewed with ease as well, does anyone know a formula to add up the hours worked each day.

    Hello
    This question was responded so much times that I don't wish to search in the old threads for you.
    Click the "more options" button,
    select the forum dedicated to Numbers
    enter a keyword like "total hours" or Duration which is a word often used in my responses about this question.
    Yvan KOENIG (from FRANCE jeudi 24 janvier 2008 21:39:08)

Maybe you are looking for