Need to Count Items in PO

I want to count the items monthly wise those are using first time in that year (APR - MAR).
For example if we use a item for PO in the month of April, May, June, .... the item should count in the month of April only
I developed one query for that
but it takes more time to run
SELECT nvl(po.no,0) New_Items,to_char(trunc(mths.dt,'MM') , 'MON-YYYY') Items_Month from
(select count( distinct a.item_id) no ,to_char(trunc(a.transaction_date,'MM'),'MM-YYYY') Monthly from
(select rsl.item_id, rt.transaction_date
from rcv_transactions rt
, rcv_shipment_lines rsl
where rt.shipment_line_id=rsl.shipment_line_id
and rt.transaction_type='RECEIVE'
and rt.transaction_date between nvl(:P_FROM_DATE, rt.transaction_date) and nvl(:P_TO_DATE, rt.transaction_date)
and rsl.item_id not in (select rsl.item_id
from rcv_transactions rt
, rcv_shipment_lines rsl
where rt.shipment_line_id=rsl.shipment_line_id
and rt.transaction_type='RECEIVE'
and rt.transaction_date < nvl(:P_FROM_DATE, rt.transaction_date))) a
group by to_char(trunc(a.transaction_date,'MM'),'MM-YYYY')) PO
, (SELECT add_months('01-DEC-2006', lvl) dt
FROM (select level lvl
from dual
connect by level < 1000)) mths
WHERE to_char(trunc(mths.dt,'MM'),'MM-YYYY')=po.Monthly(+)
and mths.dt between :P_FROM_DATE and :P_TO_DATE
order by mths.dt
please help to solve this issue
Adina

Something like this?
select count(distinct item_id) new_items,
       the_month
  from (select item_id,
               to_char(the_date,'yyyymm') the_month
               first_value(to_char(the_date,'yyyymm')) over (partition by item_id order by the_date nulls last) first_month
          from your_table -- or < your query >
where the_month = first_month
group by the_month*** not tested ***
Regards
Etbin

Similar Messages

  • How would I count items in DataSet2 and have them grouped by the column that is tied to DataSet1?

    Greetings!
    First, thank you for looking at my question. I am trying to count the number of items that = "True" in DataSet2 and display them in the "Week" column in a table who is pointed to DataSet1.
    I have a simple table that is set up something like this:
    CDC Week |
    [Week Number] from DataSet1
    | Total
    Count of Some Item |
    [CountSomeField] from DataSet1
    | [ Total of Row]
    Count of Another Item | 
    [CountOfTrueItems] from DataSet2
    | [Total of Row]
    With the expected results:
    CDC Week |
    25
    | 26 |
    27 |
    (n/a)
    Count of Some Item |
    10 |
    20 |
    30 |
    (Expected 60 but not working yet)
    Count of Another Item |
    5 |
    10 |
    15 |
    (Expected 30 but not working yet)
    Instead I get:
    CDC Week |
    25 |
    26 |
    27 | 
    (n/a)
    Count of Some Item |
    10 |
    20 |
    30 |
    (Not working yet)
    Count of Another Item |
    30 |
    30 |
    30 |
    (Not working yet)
    DataSet1 has a few columns including a "Week" column. DataSet2 has two columns, "WEEK" and "POS".
    I need to count items when POS = "TRUE" in DataSet2 and group them on the "Week" column.
    My current expression is =SUM(IIF(Fields!Pos_.Value = "True", 1, 0), "DataSet2")
    And while this returns a value, it does not count (or sum) by each week. I am missing something...
    Thank you for any assistance!
    p.s. Sorry My html skills are not shining with the table formatting :(

    Hi,
    Would you please provide some screenshots?
    Work hard, play harder!

  • Need a count for number of emails

    Hi,
    I need a count of emails coming to a mailbox in a specified date range. And i want that to be exported in an excel file.
    I was able to get the total count in a specified folder using the below cmdlet in PS but couldn't get during a specific time/date range:
    Get-Mailbox | Get-MailboxFolderStatistics | Where {$_.Name -match “Inbox|Sent Items|Deleted Items|Junk E-Mail”} | Select Identity, Name, ItemsInFolder | Export-csv c:\MailboxItemCount.csv
    Can the process be automated? As in, can i get the report generated day, week or
    month wise?
    Any help would be much appreciated.

    You would have to use Outlook or EWS for that.
    EWS calls can be scheduled.  Outlook will not run correctly without a full user interface and running under the scheduler is not supported.
    https://msdn.microsoft.com/en-us/library/office/dn535506%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396
    https://msdn.microsoft.com/en-us/library/office/dd633710(v=exchg.80).aspx
    ¯\_(ツ)_/¯

  • I bought this MAC from a family member. Did everything need to change items to my apple id. Today I did the update for IOS Yosemite now the app store is auto filling with someone else id?? But they seem to be my apps??

    I bought this MAC from a family member. Did everything need to change items to my apple id. Today I did the update for IOS Yosemite now the app store is auto filling with someone else id?? But they seem to be my apps??

    If you didn’t erase the drive and install using you AppleID, then the OS and the purchased apps are still registered to the other AppleID. You cannot change that by logging into iCloud. Apps are forever tied to the AppleID used to purchase/download them.
    You have to erase the drive and download/install the Apps using your AppleID.

  • I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me?

    I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me? The final result would be a spreadsheet telling there were 8 people from 20 to 39 years old, 14 peolple from 40 to 59 and so on...

    jpqcampos wrote:
    This appears to be an 'input form' using 'Radio Buttons' to select the category. Neither of these features are supported in Numbers '09.
    You can input the data on one table and summarize it on a second table, but the input table will continue to hold data for each event.
    And by using the Reorganize button, you can hide all but two rows of that table to approximate the appearance and performance of an input form.
    Here are the two tables, Data on the left and Summary on the right. Notes below.
    The grey-filled columns in both tables are 'working' columns, and may be hidden (as shown in the image below).
    Data table:
    D1 contains the word "TRUE" (in capital letters). (This row is always shown.)
    D2 is empty, or may contain any value except "TRUE" (This row is always hidden under the Reorganize rule.)The rest of Row 2 of this table requires the data shown: a number outside the range to be counted (999), and two checkboxes, both checked.
    D3 (and filled down the rest of column D):   =AND(OR(B2,C2),NOT(OR(B3,C3)))
    The formula returns TRUE only for the first unused row in the table (ie. the first row for which neither checkbox has been checked)
    Summary table:
    Column A contains labels for the age ranges to be counted.
    Column B contains the same information in the form necessary for the formulas in columns C and D. They need a numeric value, and that value must be the largest acceptable value in the range to be counted.
    C2 (and filled right to column D, then both filled down to row 5):
        =COUNTIFS(Data :: $A,"<="&$B,Data :: B,TRUE)-SUM(C$1:C1)
    Two changes from the previous example:
    COUNTIFS is used to separate the Native and Foreign counts as well as the age range to be counted.
    The amount subtracted from each result is the SUM of the earlier results, and includes the text value in the first cell of the column (which is interpreted by SUM as a zero).
    See note below regarding my earlier formula.
    When the greyed columns are hidden and the checkbox in the Reorganize pane is checked, the two tables will appear as shown below:
    Close the reorganize pane, and the 'data entry form' is ready to use.
    To use, enter the age first, then check one of the boxes.
    As soon as one box is checked, the row will be hidden, and the next (unused) row will be shown.
    Regards,
    Barry
    Note regarding formula in my earlier post:
    The earlier formula will give erroneous results as it subtracts only the count directly above it from its count of persons in the age range 0-n.
    In E2 of that table, replace "-E1" with "-SUM(E1:E$1)
    Fill down to E8.
    Ignore the instructions (in that post) following "Fill down to E8."
    B

  • I just got a WD My Passport 1TB External Harddrive and i have already backed everything up to it but im still a little nervous about erasing things off the physical drive since it says my disk utility is out of space an implying i need to erase items.

    I just got a WD My Passport 1TB External Harddrive and i have already backed everything up to it but im still a little nervous about erasing things off the physical drive on my macbook pro since it says my disk utility is out of space an implying i need to erase items.
    I cant find the options to erase selected items it only shows that i can erase everything.
    I mean technically i suppose i could erase everything an have a fresh start since its backed up to my external. But what exactly are the specific items being erased?
    I have bought the newest OS X 10.8.2 an worried that it will get erased also an end up having to repurchase it.
    Can anyone help me?
    <Personal Information Edited by Host>

    Black_Chevy07 wrote:
    I just got a WD My Passport 1TB External Harddrive and i have already backed everything up to it but im still a little nervous about erasing things off the physical drive on my macbook pro since it says my disk utility is out of space an implying i need to erase items.
    I cant find the options to erase selected items it only shows that i can erase everything.
    I mean technically i suppose i could erase everything an have a fresh start since its backed up to my external. But what exactly are the specific items being erased?
    I have bought the newest OS X 10.8.2 an worried that it will get erased also an end up having to repurchase it.
    Can anyone help me?
    If you are trying to delete some files get out of Disk Utility, it is not for that!
    How did you backup and what are you trying to achieve?
    Please post the exact error messages(s) you have received.

  • Need to count the number of times the Basic Finish data chages

    HI Expertes,
    I have a requirement I need to count number of times the Basic finish date chaged for PM work order. I went throug our forums I got some info like using a standard function module
    CHANGEDOCUMENT_READ_HDRS_ONLY
    CHANGEDOCUMENT_READ_HEADERS
    CHANGEDOCUMENT_READ_POSITIONS
    But all the above function module will not be suitable for my requirement since  CHANGEDOCUMENT_READ_HDRS_ONLY it gives whole changes but my requirement is just need number of changes occurred in Basic Finish date but CHANGEDOCUMENT_READ_POSITIONS can give the filed number which has been changed but still I need change id.
    So kindly suggest me wether there is any other Standard FM to get number of changes occurred in Basic Finish date?
    Thanks,
    Rajesh

    Hi Debbie,
         To count the number of groups please try the folling steps:
    1) Create a formula @reset and place this formula in the page header
        whileprintingrecords;
        numbervar i:=0;
    2) Create another formula @evalgroup place this in the group header where you want to count the values.
        whileprintingrecords;
        numbervar i:= i+1;
    3) Create another formula @display and place this in report footer.
        whileprintingrecords;
        numbervar i;
    In order to display the count of details which are printing in the detail section place the eval formula in the detail section and the @display formula in the group footer.
    Hope this helps!!!
    Regards,
    Vinay

  • Arraylist.toString (need to count amount of a specific character in a list)

    hi
    I have a sql query that im using to populate a ArrayList<String>. I need to count the amount of "+" symbols in the all of the list. My first idea was to use Arraylist.toString and then run the resulting string through this method
    public static int countMsgs(String result){
              int counter = 0;
              for(int i=0;i<result.length();i++)
                        if(result.charAt(i)=='+')
                        counter++;                                      
              return counter;However when I do this:
    ResultSet userid1021result = sql.executeQuery
          ("select address from MESSAGES where SENT_TIME >=  '" + start + " 00:00:00' AND SENT_TIME <= '"+ end + " 23:59:59' "
          + "and USER_ID = 1");
          while (userid1021result.next()) {
                  String addresses = userid1021result.getString("address");
                  userid1021.add(addresses);
          String blah = userid1021result.toString();
          System.out.println(blah);It outputs "com.mysql.jdbc.JDBC4ResultSet@1abc7b9" which is obviously not what i was expecting
    How do i get the contents of the arraylist into one big string so I can run it through my countMsgs method?
    Thanks

    Guys,
    Where a, b, and c are strings: plusesIn(a) + plusesIn(b) + plusesIn(c) == plusesIn(a+b+c)
    Ergo, concatenating the strings is just a waste of time.
    Also... I'd factor out the character-to-find from countMsgs to make a static helper method (in a "reusable" StringUtils class)...
    * Returns the number of times target occurs in string
    public static final int occurences(String string, char target) {
      int count = 0;
      for ( char c : s.toCharArray() ) { // 1.6 only
        if( c == target ) count++;
      return target;
    }

  • Need to count character from an xml

    Hi all,
    I need to count character from a field. and store it in a variable. My datasource is from xml file.
    Any ideas for the syntax?
    thanks in advance,
    Paolyn

    Use <?string-length(FIELD)?> to get the count of characters.

  • I need a count "UP" timer for a client.

    I have kind of a strange request, but it's from a strange client so it's not surprising.
    The client needs a counting UP timer, not a count DOWN timer, so please don't refer me to that widget, I already used it.
    The original countdown timer has expired, so now she wants a timer that will count the days, hours, minutes & seconds SINCE that timer expired.
    Website splash page: http://www.theapocalypse.ca so you can see what I mean.
    Is it possible to "crack" the existing widget and just "reverse" it, or is there something I can build in edge animate that will work?
    I know, WEIRD, but hey, a paycheque is a paycheque.
    Thanks guys!

    You may try this : http://www.tickcounter.com/countup/widget
    Thanks,
    Sanjit

  • Need to count values in Report

    I have a column in report which displays X. 
    I need to count total no of X
    Abhinav

    =SUM(IIF(Fields!Status.Value="X",1,0))
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • I need to count intermitte​nt high speed pulses from an outside source with cFP-CTR-50​2 and labview.

    I need to count intermittent high speed pulses from an outside source with cFP-CTR-502 and Labview 8.2 . I've found example code for generating pulses and creating intricate count setups but no straightforward examples of a simple counter. Any suggestions?

    Hello tinfish,
    I could not find a simple example that implements simple counting either, but it should be straightforward enough for us to try. Do you have the CTR module configured properly in MAX? If so, can you monitor the channels on your CTR 502 for input? Try connecting a square wave or some other digital pulse to the terminal to test the functionality of the counter module first (before programming). If you monitor the input channels with somethign connected you should see the count increment each time it sees a rising edge (assuming default configuration).
    Once you've verified that everything works in MAX, you can set up your CTR module in a LV 8.2 project. If you need help with this, refer to the help document (look in the "Configuring FieldPoint in LabVIEW" section):
    C:\Program Files\National Instruments\FieldPoint\documentation\Online Help\fplv.chm
    You should be able to just read a channel tag from your CTR 502 using an FP Read VI. (Simply drag the channel from your project onto the block diagram). Since counting is the default behavior of the 502, there is no special programming involved to make it work.
    I hope this helps -- if it's too high-level we can talk details about specific questions you have.  Have a good one!
    Charlie S.
    Visit ni.com/gettingstarted for step-by-step help in setting up your system

  • I need the Count to display "0" when the count = 0

    I'm creating a report that is run weekly.  Each week, one or more of the categories may turn up 0.  As this is being used as a sub report in another report, I need the count to show "0" when there is no data for the week as it is aligned with another sub report listing all the categories possible.
    The following is the formula I am currently working on:
    if(IsNull(Count ({UV_HRSRespClnByAreaDetail.SubType},{UV_HRSRespClnByAreaDetail.Stat})))
    then u201C0u201D
    else Count ({UV_HRSRespClnByAreaDetail.SubType},{UV_HRSRespClnByAreaDetail.Stat})
    This will not turn up 0, it still gives me a blank.  Any thoughts?

    Hi Aneisha
    You can check if the following formula works for you:
    numberVar cnt;
    cnt=(Count ({UV_HRSRespClnByAreaDetail.SubType},{UV_HRSRespClnByAreaDetail.Stat})
    if (IsNull(cnt)) then u201C0u201D
    else cnt;
    Hope this helps you.
    Regards
    Ashwini Yadav

  • My broadband has 2MB download limit I need a counter to see how much I use.

    My broadband has 2MB download limit I need a counter to see how much I use. Please recommend one that I can start counting at the start of the month and be able to see how many MB I have downloaded at the end of the month to be able to work out what amount I need to pay for.

    Oops I mean a 2GB/month allowance. And I found Intego Content Barrier does it.

  • Counting items in the array

    Hello,
    I need a clean way to count the items in an array. I can sort them using :
    int []x=new int[150]; I'm using Math.random%10 to get intergers from 0-9;
    public static void countItem() // sort items in the array
    int min, temp;
    for (int i = 0; i < x.length-1; i++)
    min = i;
    for (int scan = i+1; scan < x.length; scan++)
    if (x[scan] < x[min])
    min = scan;
    // Swap the values
    temp = x[min];
    x[min] = x;
    x[i] = temp;
    but once they are sorted I am baffeled on a clean way to count how many of each item are listed.
    0001122222222333444444 etc up to 9.
    Thanks

    but once they are sorted I am baffeled on a clean way to count how many of each item are listed.
    0001122222222333444444 etc up to 9I think you're going about this the wrong way. First count, then you've implicitly sorted them (counting sort). public class CountingSort
        public static void main(String[] args)
            int[] arr = {4, 5, 1, 3, 3, 3, 7};
            countSort(arr);
            for (int i = 0; i < arr.length; i++)
                System.out.print(arr[i] + " ");
        static void countSort(int[] arr)
            // Assume all elements of arr are in range 0..9
            // initialise buckets to an array of zeroes - don't rely on this except in Java
            int[] buckets = new int[10];
            for (int i = 0; i < arr.length; i++)
                buckets[arr]++;
    // Now reconstruct the array in sorted order
    // k is the next element in the array to fill in
    int k = 0;
    for (int i = 0; i < arr.length; i++)
    while (buckets[i]-- > 0)
    arr[k++] = i;

Maybe you are looking for

  • Safari does not display correct font

    I just upgraded to Snow Leopard. When I did this, it did something to the fonts displayed in Safari 5.1.7. When I go to a webpage (like someone's blog) the entire body of text is in a cursive font. I've tried emptying the cache, changing the fonts in

  • How to get current system date and store in db

    may i know how to get the current system date so that i can store it into the database

  • Itunes 11.4 crash OSX 10.9.5 wont sync IOS7.0.4 5s Phone

    Itunes Version - 11.4 (18) 64 bit Mac OSX 10.9.5 To Whom that can assist, The OSX and Itunes 11.4 runs fine until I attempt a sync my IOS 7.0.4 Iphone 5s, Ipad, or any device. Itunes crashes, no response, gets a forever colourful revolving ferris whe

  • Regarding ios 6 Installation.

    I am using ios 5.1 in my ipd touch. I want to install ios 6 to my apple ipod touch. So can i simply switch on my wi fi in ipoc touch and install it? without backing up any files, applications and music. Will i loose all the files which is now in ipod

  • Video & Audi Chat failed to AOL Messenger 6.1

    Hello everyone, (sorry for my bad english) I use ichat AV 4.0 (Leopad of course) and my girlfriend AOL Messenger 6.1 on Vista (32bit). The connection failed if we start a video or audio chat. The dialog box or messenger shows a message like; "the use