Help with Planning Query - 0CALMONTH not showing up

Hi, I have a simple planning query where I am trying to allow users to input or change an Amount by Material/Month.  The User inputs a Version and a Date Range to maintain.  The selected dates should show up going across the screen even if there is no existing data.  These Variables are in the Query Filter along with a few other characteristic Filters.  So in my query I have 0MATERIAL in the Rows and I have 0CALMONTH and my Key Figure.  Under advanced for the characteristic 0CALMONTH it is set as Master Data.
When I run the query for some reason the 0CALMONTHS do not show up going across.  If I run the query and put in one value then the 12 months show up.  Seems like a bug.  I have another similar query where this works.  Can anyone take a look at the screen shots and help me figure this out?
[Query Def Screen 1|http://i35.tinypic.com/1h8con.png]
[Query Def Screen 2|http://i36.tinypic.com/1f781c.png]
[0MATERIAL Def|http://i36.tinypic.com/xefq8i.png]
[0CALMONTH Def|http://i35.tinypic.com/ej8qpv.png]
Thanks!
Edited by: Kenneth Murray on Nov 5, 2009 3:12 PM

Dear  Kenneth,
I think its a bug.  If we post the value without the drilldown on 0CALMONTh then its open for the input, and after that if we drill down it with 0CALMONTH for same selection, it opens for input.  but for new selection of month it not opens.
Have you solved the problem?
Regards,
V B Udani

Similar Messages

  • Help with Planning Query

    I have a planning query with Material in the Rows, 0CALMONTH and Amount in the Columns.
    For a query selection the user puts in only version and month Date range say 04/2009 - 03/2010.  What I would like to happen is initially present the user with 3 empty rows where they input the Material and the different amounts going across for the selected 12 months.  Initially there is no planning data and all my efforts fail I think because I do not have any available values for material to plan against.  Is this possible?
    I have another similar query, but I have fixed values on the left.
    Can anyone help with this?

    Hi thanks for your patience.
    I am trying to get a planning query with 3 empty rows to start.  The User inputs the Month Range.  In each row I would like and empty field for Material input and empty key figure fields for each of the months in the range.  I have a similar query already, but instead of starting with no Materials I have fixed materials and it works fine.  It's just a problem when I'm starting out with no materials.   Any ideas?   Thanks for your help.
              Month 1 Month 2 Month 3,
    Material, Amount, Amount, Amount, ...
    Material, Amount, Amount, Amount, ...
    Material, Amount, Amount, Amount, ...

  • Help with I Web- Pages not showing links

    Hi,
    I was wondering if someone can help me out. I tried to publish a default page, just the welcome page and podcast page (all default). It published ok to the server but when I visited the site it doesnt show any link to the podcast page.
    When I tried to only publish the podcast page (Ive deleted the welcome screen), the podcast page doesnt even show the default video and sound i.e. no entries, however I can see it in Iweb and I can also subscribe to it from the Itune using RSS feed.
    Can someone Please Please help. Thanks

    It would be a lot easier to see what you are talking about and perhaps see what the problem is if you would provide your url.

  • The document associated with a query is not showing on the query

    I've created a document in the document tab and assigned the multi-provider and query to it.  when I run the query I don't see it anywhere and when I go to documents nothing happens.  Am I missing a step somewhere?

    HI Antony Jerald J,
    Do you have variables in your Bex Query.
    Please check the pre requisites in the following link:
    http://help.sap.com/saphelp_nw73ehp1/helpdata/en/b6/53d6c4e26a4504b8971c6e690d2105/frameset.htm
    BR
    Prabhith

  • Please, need help with a query

    Hi !
    Please need help with this query:
    Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
    Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
    select distinct a.id,
    create_date,
    a.loanid,
    a.rate,
    a.pays,
    a.gracetime,
    a.emailtosend,
    d.first_name,
    d.last_name,
    a.user_id
    from CLAL_LOANCALC_DET a,
    loan_Calculator b,
    bv_user_profile c,
    bv_mr_user_profile d
    where b.loanid = a.loanid
    and c.NET_USER_NO = a.resp_id
    and d.user_id = c.user_id
    and a.is_partner is null
    and a.create_date between
    TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
    TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    order by a.create_date

    Take a look on the syntax :
    max(...) keep (dense_rank last order by ...)
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions056.htm#i1000901
    Nicolas.

  • Please need help with this query

    Hi !
    Please need help with this query:
    Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
    Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
    select distinct a.id,
    create_date,
    a.loanid,
    a.rate,
    a.pays,
    a.gracetime,
    a.emailtosend,
    d.first_name,
    d.last_name,
    a.user_id
    from CLAL_LOANCALC_DET a,
    loan_Calculator b,
    bv_user_profile c,
    bv_mr_user_profile d
    where b.loanid = a.loanid
    and c.NET_USER_NO = a.resp_id
    and d.user_id = c.user_id
    and a.is_partner is null
    and a.create_date between
    TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
    TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    order by a.create_date

    Perhaps something like this...
    select id, create_date, loanid, rate, pays, gracetime, emailtosend, first_name, last_name, user_id
    from (
          select distinct a.id,
                          create_date,
                          a.loanid,
                          a.rate,
                          a.pays,
                          a.gracetime,
                          a.emailtosend,
                          d.first_name,
                          d.last_name,
                          a.user_id,
                          max(create_date) over (partition by a.user_id, a.loadid) as max_create_date
          from CLAL_LOANCALC_DET a,
               loan_Calculator b,
               bv_user_profile c,
               bv_mr_user_profile d
          where b.loanid = a.loanid
          and   c.NET_USER_NO = a.resp_id
          and   d.user_id = c.user_id
          and   a.is_partner is null
          and   a.create_date between
                TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
                TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    where create_date = max_create_date
    order by create_date

  • Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??

  • Need urgent help with the query - Beginer

    Hello - I need help with a query to populate data in a table.Here is the scenario.
    Source1
    MnthID BranchCod CustID SegCode FXStatus ProfStatus Profit
    200712 B1 C1 20 Y Y 100
    Source2
    MnthID BranchCod CustID ProdCode ProdIndex
    200712 B1 C1 12 1
    200712 B1 C2 12 0
    Destination
    MnthID BranchCod SegCode ProdCode CountSegCust CountProdCust ProfitProdCust
    Condition and Calculations:
    1)Source1 customer are base customers.If Source2 has customers who is not in source1 then that customer's record should not be fetched.
    2)SegCode, FX Status, ProfStatus is one variable in destination table. [ SegCode = SegCode+ FXStatus (if FXStatus = Y)+ ProfStatus (if FXStatus = Y) ]
    3)CountSegCust = CountCustID Groupby MnthID,BranchCod,SegCode Only.
    4)CountProdCust = CountCustID Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
    5)ProfitProdCust = Sum of Profit of Customers Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
    Apologies for bad formatting.
    Thanks in advance!!

    A total guess indeed.
    It's not clear whether some aggregation can be done (summing counts of grouped data might cause some customers being counted more than once)
    insert into destination
    select mnthid,branchcod,segcode,prodcode,countsegcust,countprodcust,profitprodcust
      from (select s1.mnthid,
                   s1.branchcod,
                   s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end segcode,
                   s2.prodcode,
                   count(s1.custid) over (partition by s1.mnthid,
                                                       s1.branchcod,
                                                       s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                              order by null
                                         ) countsegcust,
                   count(case proindex when 1
                                       then custid
                         end
                        ) over (partition by s1.mnthid,
                                             s1.branchcod,
                                             s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                             s2.prodcode
                                    order by null
                               ) countprodcust,
                   sum(case proindex when 1
                                     then profit
                       end
                      ) over (partition by s1.mnthid,
                                           s1.branchcod,
                                           s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                           s2.prodcode
                                  order by null
                             ) profitprodcust,
                   row_number() over (partition by s1.mnthid,
                                                   s1.branchcod,
                                                   s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                                   s2.prodcode
                                          order by null
                                     ) the_row
              from source1 s1,source2 s2
             where s1.mnthid = s2.mnthid
               and s1.branchcod = s2.branchcod
               and s1.custid = s2.custid
    where the_row = 1Regards
    Etbin

  • How to make preflight profile witch find out if exist in document spot color with name "CutContour", if not show allert,  I try many combinations but nothing works

    How to make preflight profile witch find out if exist in document spot color with name "CutContour", if not show allert,  I try many combinations but nothing works

    Thanks very much for your help, but I'm still overlooking something. I double checked to make sure that I did not have a hidden .txt file extention. I then decided to abandon the lock on preferences idea until I get it working. I converted my mozilla.cfg file back to plain text. I made sure I do not have an extra blank line at the end of each file. The syntax looks good, as far as I can tell. I'll copy and paste what I have so far. Did I have the file locations correct posted above? Also, if you feel i can delete some lines of text in my mozilla.cfg file I'll be happy to do so.
    mozilla.cfg
    <pre><nowiki>//
    pref("privacy.sanitize.sanitizeOnShutdown", true);
    pref("privacy.sanitize.promptOnSanitize", false);
    pref("browser.rights.override", true);
    pref(“app.update.auto”, false);
    pref(“extensions.blocklist.enabled”, false);
    pref(“extensions.shownselectionUI”, true);
    pref(“browser.shell.checkDefaultBrowser”, false);
    pref(“toolkit.telemetry.enabled”, false);
    pref(“toolkit.telemetry.prompted”, 2);
    pref(“toolkit.telemetry.rejected”, true);
    pref(“app.update.auto”, false);
    pref(“browser.download.useDownloadDir”, true);
    pref(“browser.search.update”, false);
    pref(“signon.autofillForms”, false);
    pref(“signon.rememberSignons”, false);
    pref(“browser.download.manager.scanWhenDone”, true);
    pref(“browser.formfill.enable”, false);
    pref(“xpinstall.enabled”, true);</nowiki></pre>
    channel-prefs.js
    pref("app.update.channel", "release");
    override.ini
    [XRE]
    EnableProfileMigrator=false
    all-lmc.js
    pref("general.config.filename", "mozilla.cfg");
    defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://bbc.co.uk");
    Again, thank you very much for your time. Do I create my own browserconfig.properties, and firefox.js? Also, I forgot to mention I'm running Windows 8.

  • Want to upgrade to lastest version - help/about Firefox window does not show "upgrade" as in instructions.

    I want to upgrade to latest version but -Help/About Firefox- window does not show "upgrade" as in the instructions. I cannot find an "upgrade" function anywhere else. How do I upgrade? The version I have is -18.0.1- it came with this used computer.
    I believe this computer was hacked. Word started doing very strange things. We wiped the hard drive and reloaded everything as it was originally when I bought it. I am now getting hacked online.
    They originally got into one of my credit cards last fall. That is when this all started. They got my AOL email address. They also got the credit card current balance, minimum payment, due date and then even the payment amount. They got into my Barnes & Noble account and now checkout does not work. Now I believe they have gotten into my AOL account - one thing after another has started going wrong. I cannot change that AOL user id/email address since it is the master and I would lose about 15 years of "stuff".
    The folks that sold me this computer told me to use a free version of an antivirus. I am very unhappy with it. I never had ANY trouble when I used TrendMicro's expense products. Those folks also told me to use Firefox, since AOL uses Internet Explorer - which I already knew is like Swiss cheese.
    Now, I cannot seem to get an upgrade of Firefox. Is this also a hack?
    Please help any way you can. Thank you for your time.

    It's probably just the Firefox updater having some problems. go to www.getfirefox.com and download Firefox 20.0.1

  • Help with slooow query

    I created a blogging tool for my students to use as I teach
    them internet safety and cyber citizenship. I am no CF master, but
    I dabble a little bit here and there. I need some help with this
    query. It is running extremely slow, which means I have probably
    created some horrendous loop in this query. If any one out there
    has a better solution for this query, I and my middle school
    students would be extremely grateful.
    Here's what I would like it to do. I have two tables, one for
    the blog messages and another for comments. The comments are linked
    to their respective blog messages through a common database field.
    When someone clicks on a link to read a student's blog, a query
    runs which pulls all of the blog messages for that user, the
    comments, and it also counts the number of comments entries for
    each message so that I can place a total # of comments under each
    blog message.

    Not sure why you have this like this: (Select
    count(commentid) from comments where comments.blogid = blog.blogid)
    or this twice: blog.blogusersid = #fname#
    You need to make sure that the comments.blogid and
    blog.blogid fields are indexed. Does this query work any faster?
    <cfquery Name="Myblog" datasource="blog">
    SELECT b.blogid, b.btitle, b.bcontent, b.bdate,
    b.blogusersid, b.fname, b.lname, b.blogpict, b.pictlocation,
    b.userid, c.commentid, c.blogid, b.lastupdated, COUNT(c.commentid)
    AS cc
    FROM blog AS b
    INNER JOIN comments AS c ON c.blogid = b.blogid
    WHERE b.blogusersid = #fname#
    GROUP BY b.blogid, b.btitle, b.bcontent, b.bdate,
    b.blogusersid, b.fname, b.lname, b.blogpict, b.pictlocation,
    b.userid, c.commentid, c.blogid, b.lastupdated
    ORDER BY b.bdate
    </cfquery>
    ..... but I'm not sure that you will be getting the comment
    count that you want with either query.
    Phil

  • TS2771 I need help with my camera it's shows a black screen. And I have restarted it many times

    I need help with my camera it's shows a black screen. And I have restarted it many times

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                                
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem. Y are not alones. Sometimes the camera fails.
    Apple Retail Store - Genius Bar                                      

  • Please help with tricky query

    I need help with SQL query (if it can be accomplished with query at all).
    I'm going to create a table with structure similar to:
    Article_Name varchar2(30), Author_Name varchar2(30), Position varchar2(2). Position field is basicly position of an article author in the author list, e.g. if there is one author, his/her position is 0, if 2, then 1st author is 0, second is 1, etc.
    Article_Name Author_Name Position
    Outer Space Smith 0
    Outer Space Blake 1
    How can I automate creation of Position, based on number of authors on the fly? Let's say I have original table without Position, but I want to create a new table that will have this information.
    Regards

    If you have an existing table whose structure doesn't tell you what position the author is in, what's the algorithm you'd use to determine who was the first author, the second author, etc? If you issue a select query on a table without providing an "order by" clause, Oracle makes no guarantees about the order in which it retrieves rows.
    As an aside, why would you store position number in a varchar2 field? If it's a number, it ought to be stored as a number.
    Justin

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • Help with aging query. not sure how to acomplish this???

    Guys im a bit stuck usually i have a slight idea how to even start my query but for this particular one I just dont even know where to start to tackle
    i have a table like so.
           create table TRRACCD (
           TRRACCD_GRNT_CODE varchar2(6),
           TRRACCD_TRANS_dATE date,
           TRRACCD_AMOUNT number(17,2),
           trraccd_detail_code varchar2(6))with data like so
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('15-FEB-10', 'DD-MM-RR'),19764.77,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('12-MAR-10', 'DD-MM-RR'),2054.29,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('20-APR-10', 'DD-MM-RR'),4111.46,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('14-MAY-10', 'DD-MM-RR'),2570.1,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-JUN-10', 'DD-MM-RR'),2176.16,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('12-JUL-10', 'DD-MM-RR'),4756.29,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('13-AUG-10', 'DD-MM-RR'),28500.62,'GCSH');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('16-AUG-10', 'DD-MM-RR'),3602.3,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('17-SEP-10', 'DD-MM-RR'),3995.79,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-OCT-10', 'DD-MM-RR'),3413.6,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-NOV-10', 'DD-MM-RR'),2119.86,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-DEC-10', 'DD-MM-RR'),5905.52,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('10-DEC-10', 'DD-MM-RR'),12008.21,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-JAN-11', 'DD-MM-RR'),-10574.05,'GBIL');
    INSERT INTO TRRACCD (TRRACCD_GRNT_CODE, TRRACCD_TRANS_DATE, TRRACCD_AMOUNT, TRRACCD_DETAIL_CODE) VALUES ('400364',to_date('11-JAN-11', 'DD-MM-RR'),20241.9,'GBIL');however what i need to do is end up with an aging for the items summarize so the expected output should be something like
    tbrraccd_grnt_Code      30-60                    60-90         over90
    400364                      20,241.90              2119.86       7,370.09 
    if your confused about how i arrived at the 7370.90 is because i have to subtract entries with GCSH on them and i also need to take
    entries that are - and applied them to the oldest period if the balance of the period is positive. im inclined to say that i can do this with sql but the only other way i can think of is using plsql?... any suggestions or solutions would be greatly appreciated.
    the closest that i have gotten to acomplishing this query without pl is this. i know is lame but i need help.
    SELECT TRRACCD_GRNT_CODE,
           TRRACCD_TRANS_dATE,
           TRRACCD_AMOUNT,
           trraccd_detail_code,
           round(sysdate - TRRACCD_TRANS_dATE) "total days"
           --sum(case when round(sysdate - TRRACCD_TRANS_dATE)>190 then "greater then 190"end )
           FROM TRRACCD
           where trraccd_grnt_Code = '400364'
           ORDER BY TRRACCD_GRNT_CODE,
                    TRRACCD_TRANS_dATE,
                    trraccd_detail_code;  

    Hi, Miguel,
    I should have mentioned this before: I'm assuming SYSDATE is some point on January 22, 2011, after 00:00. I don't think this has caused any confusion so far, but if the discussion continues for a day or two, let's be clear about that.
    I think I see what you want regarding the rows where trraccd+detailcode='GSCH'. If we completly ignored all the GSCH rows, we would get this output:
    TRRACC       0-29      30-59      60-89    90-over
    400364   ...
    400404   19904.97    6625.27    4757.01   67618.68You want GSCH amounts to cancel other amounts in the last column only until that column reaches 0 ; the remaining GSCH amount will cancel amounts in to "60-89" column, again, only until that amount reaches 0 . If there is anything left over, it will cancel amounts in the "30-59" column, and if there is still some left over, the "0-29" column.
    To be specific, trraccd_grnt_code=400404 has a total of 72475.69 from GSCH rows. That counts against the "90-over" total.
    67618.68 - 72475.69 = -4757.01; you want to dispaly 0 in the "90-over" column, and apply the remaining 4757.01 to the next column to the left.
    That column contains 4757.01, which happens to be the exact maount left over from the previous subtraction, so you want to diesplay 0 in the "60-89" column.
    The remaining columns to the left should contain their regular totals.
    Here's one way to do that:
    WITH     got_col_num     AS
         SELECT     trraccd_grnt_code
         ,     CASE
                   WHEN  trraccd_detail_code != 'GCSH'     THEN  trraccd_amount
              END          AS net_amount
         ,     SUM ( CASE
                        WHEN trraccd_detail_code = 'GCSH'     THEN  trraccd_amount
                    END
                  ) OVER (PARTITION BY trraccd_grnt_code)     
                                 AS gsch_total
         ,     CASE
                  WHEN  trraccd_amount < 0               THEN  4
                  WHEN  trraccd_trans_date > SYSDATE - 30     THEN  1
                  WHEN  trraccd_trans_date > SYSDATE - 60     THEN  2
                  WHEN  trraccd_trans_date > SYSDATE - 90     THEN  3
                                            ELSE  4
              END          AS col_num
         FROM     trraccd
         WHERE     trraccd_trans_date     <= SYSDATE
    ,     got_sum          AS
         SELECT       trraccd_grnt_code
         ,       col_num
         ,       LEAST ( SUM (net_amount)
                     , GREATEST ( 0
                                , SUM (SUM (net_amount)) OVER ( PARTITION BY  trraccd_grnt_code
                                                                 ORDER BY        col_num   DESC
                                  - gsch_total
                   )  AS total
         FROM       got_col_num
         GROUP BY  trraccd_grnt_code
         ,       col_num
         ,       gsch_total
    SELECT       trraccd_grnt_code
    ,       SUM (CASE WHEN col_num = 1 THEN total END)     AS "0-29"
    ,       SUM (CASE WHEN col_num = 2 THEN total END)     AS "30-59"
    ,       SUM (CASE WHEN col_num = 3 THEN total END)     AS "60-89"
    ,       SUM (CASE WHEN col_num = 4 THEN total END)     AS "90-over"
    FROM       got_sum
    GROUP BY  trraccd_grnt_code
    ORDER BY  trraccd_grnt_code
    ;Whenever you want to understand a query like this, run just the first sub-query (in this case, got_col_num) and make sure you understand what it's doing. When you do, add one more sub-query, and make sure you understand what it's doing.
    Add morte columns to the display to help you understand it better. For example, when you get to the point where you're trying to understand the 2nd sub-query above, got_sum, you might run this query:
    WITH     got_col_num     AS
         SELECT     trraccd_grnt_code
         ,     CASE
                   WHEN  trraccd_detail_code != 'GCSH'     THEN  trraccd_amount
              END          AS net_amount
         ,     SUM ( CASE
                        WHEN trraccd_detail_code = 'GCSH'     THEN  trraccd_amount
                    END
                  ) OVER (PARTITION BY trraccd_grnt_code)     
                                 AS gsch_total
         ,     CASE
                  WHEN  trraccd_amount < 0               THEN  4
                  WHEN  trraccd_trans_date > SYSDATE - 30     THEN  1
                  WHEN  trraccd_trans_date > SYSDATE - 60     THEN  2
                  WHEN  trraccd_trans_date > SYSDATE - 90     THEN  3
                                            ELSE  4
              END          AS col_num
         FROM     trraccd
         WHERE     trraccd_trans_date     <= SYSDATE
    ,     got_sum          AS
         SELECT       trraccd_grnt_code
         ,       col_num
         ,       gsch_total
         ,       SUM (net_amount)               AS period_sum
         ,       SUM (SUM (net_amount)) OVER ( PARTITION BY  trraccd_grnt_code
                                              ORDER BY      col_num     DESC
                                   )         AS running_sum
         ,       LEAST ( SUM (net_amount)
                     , GREATEST ( 0
                                , SUM (SUM (net_amount)) OVER ( PARTITION BY  trraccd_grnt_code
                                                                 ORDER BY        col_num   DESC
                                  - gsch_total
                   )  AS total
         FROM       got_col_num
         GROUP BY  trraccd_grnt_code
         ,       col_num
         ,       gsch_total
    SELECT       *
    FROM       got_sum
    ORDER BY  trraccd_grnt_code
    ,            col_num
    ;which produces this output:
    TRRACC    COL_NUM GSCH_TOTAL PERIOD_SUM RUNNING_SUM      TOTAL
    400364          1   28500.62    20241.9     76146.2    20241.9
    400364          2   28500.62   17913.73     55904.3   17913.73
    400364          3   28500.62    2119.86    37990.57    2119.86
    400364          4   28500.62   35870.71    35870.71    7370.09
    400404          1   72475.69   19904.97    99005.93   19904.97
    400404          2   72475.69    6625.27    79100.96    6625.27
    400404          3   72475.69    4857.01    72475.69          0
    400404          4   72475.69   67618.68    67618.68          0The total column in that sub-query is very complicated, so break it down some. You can see that it is based on an analytic SUM whose argumenet is an aggregate SUM, all wrapped in LEAST and GREATEST. That can be very hard to underrstand, so break it down. Display the aggregate SUM by itself (period_sum) and also display the analytic SUM, without the GREATEST and LEAST.
    mlov83 wrote:
    where can i get more information about these types of querys?Can you be more specific? What types of queries do you mean? Complicated queries? Pivots? GROUP BY?
    ... I'm always leary of using a solution that i dont understand Excellent reaction!
    would you mind expalining it to me a little.Again, could you be more specific? I don't mind explaining things to you, but I don't want to explain parts you already understand. If something is new, you'll want to read the SQL Language manual, or other sources, anyway, so it's more efficient to do that first, and then post specific questions on this forum.
    An example of a more specific question is: "When I looked up "WITH clause" in the SQL Language reference, I found this page:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#sthref9758
    but I don't understand where it says ...
    The query above says ... Is that what the manual is talking about when it says ...?"
    Another example of a good question is
    "The query you posted says ... I don't understand what that's doing. I looked for ... and ... but that didn't seem to have anything to do with this query. What should I look for?
    The Oracle 10 SQL Language manual is indexed pretty poorly. If you can't find something, it may not be your fault.

Maybe you are looking for

  • Tivo shenanigans.

    Alright, I KNOW I'm overcomplicating things, and may be asking some danged dumb questions. Hopefully, you'll humor me. I've actually been looking, but, alas, the knowledge gods are spurning me for doubting there's an easy way. So here's what I've got

  • Front Row Sharing - Some TV shows not showing up

    Hi all, I have a problem with iTunes' shared libary - it only shows a subset of TV shows within iTunes. I have a Mac Pro in my den, which hosts a pretty large itunes library (about 750GB), of which 350GB are TV shows I've either bought from iTunes or

  • Solaris Express Developer Edition + Apple Airport Extreme

    I just installed Solaris Express Develper Edition without any problems, but I can't seem to get my wireless connection up and running. I use an Apple Airport Extreme and while my MacBook with Mac OS X and my Xubuntu machine have no problems connectin

  • Can't Freeze Row/column in Web layout in Integrated planning

    Hi Guys we have 50 columns in planning query. Web layout screen can't present all these column in one screen . While scrolling for viewing rest of the columns the initial column(Description) disappears i.e scrolled out and hence it is very difficult

  • Urgent !!!!!!!!!!!!!Uploading File problem

    Hi I stucked on a problem...... I want to upload file from html page....On this page I want only a upload button so that when I click on this button file will upload from my client m/c to server m/c.... I have code n all but browse button on html pag