How show the last record by date

Hi Gurus,
i got in the cube the next records for example:
calday                  Material    Quantity
01.01.2011             A                 10
15.01.2011             A                  20
if i present in the query these IO an KF the query will show these 2 records, now i want just show the last record by date
calday                  Material    Quantity
15.01.2011             A                  20
i tried in the query with a calculate KF with exception aggregation , MAX with Reference to calday , but this still show both records... how can i do it? help gurus.

Hello,
If there are sales occuring for the material on two different dates and you include date in there will be always two records.
I dont understand the need to show the last transaction. Anyways if you still need that you need to remodel the backend.
Put a DSO on the cube with date in the data field, this will always overwrite the value for the key combination you need.
Then you can return on this DSO.
Regards
Shashank

Similar Messages

  • Function to return a value of a object based on last record by date

    Post Author: Tned
    CA Forum: Desktop Intelligence Reporting
    Can anyone assit with a method/formula to return the a value of an object based on the last record by date. BO 5 or XI. See example below. Query structure is not an issue. Only need help with the last record function or aggregate.
    Data Table         
    ID / Serial #
    Date
    Status
    Condition
    Abc1
    01/01/08
    1
    A
    Abc1
    01/02/08
    1
    Z
    Abc1
    01/02/08
    3
    Z
    Abc1
    01/04/08
    2
    D
    Abc1
    01/05/08
    5
    E
    Abc2
    01/01/08
    1
    F
    Abc2
    01/02/08
    2
    Z
                                                                                    Desired query results. Only the values of the latest records returned.                      
    ID / Serial #
    Status
    Condition
    Abc1
    5
    E
    Abc2
    2
    Z

    Post Author: Tned
    CA Forum: Desktop Intelligence Reporting
    Thanks Prashant
    However, when i add either the status or condition variables to the report all lines related to the ID are returned not just the last entery by date.
    Thanks again.Terry

  • How can I show the last amend date of the .rpt file on my report?

    I want to show the last amendment date of the .rpt file on my report. 
    Modification date and time refer to the actual report rather than the .rpt file.
    Does anyone have any suggestions?  I am using version 11.2.
    Thanks,
    Anne-Marie

    annemarier,
    Have you tried the "Modification Date" or "Modification Time" fields located under the Special Fields section of the Field Explorer?
    I've never used them, but they seem like good candidates.
    Jason

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • How to get to the last record of an APEX report automatically?

    In Oracle Forms there is a "lastrec" command which can be placed after a call to a multi-row form.  The records called have the last record at the bottom of the page.  For example, if there are 100 records and there are 10 rows on the form, record numbers 91 through 100 would be showing.  Can this be done in APEX?  I have a user who wants it this way.  I set the report page up to be ordered descending, which gives her last record at the top of the page, but this is not acceptable to her.  She wants to see the last record, but she wants it at the bottom of the page. 

    Hi,
    Try this query, it should order your data as you want and the report pagination is not broken!
    The number of row displayed must be the same as the divide by value (ie. 10)
    select your_id
    from your_table
    order by trunc ((DENSE_RANK() OVER (  ORDER BY your_id desc) -1) /10)
        , DENSE_RANK() OVER (  ORDER BY your_id desc) desc;
    Page 1 displays 91 to 100
    Page 2 displays 81 to 90
    Also if your data set have 87 rows, Page 1 will display 78 to 87 (ie. the 10 last rows).
    If you want more details regarding the sorting you can have a look on this query:
    select your_id
         , trunc ((DENSE_RANK() OVER (  ORDER BY your_id desc) -1) /10)
         , DENSE_RANK() OVER (  ORDER BY your_id desc)
    from your_table
    order by 2, 3 desc;

  • How to take a value of the first record/occurrence and the last record?

    Hi experts
    Can anyone help me to tell me:
    How to make IP can take a value of the first record/occurrence and the last record in CSV file?
    I need to take the first and last to put StarTime of first record y StopTime of last record in the target file
    This is my Original CSV File
    20110820,220DNE0220,140.13 ,0.000 ,E01,0
    20110820,240FGC4280,103.80 ,0.000 ,E01,0
    20110821,220DNE0220,142.58 ,0.000 ,E01,0
    20110821,240FGC4280,88.70 ,0.000 ,E01,0
    20110822,220DNE0220,151.92 ,0.000 ,E01,0
    20110822,240FGC4280,91.47 ,0.000 ,E01,0
    Where:
    The firts field is date.
    I require it so my Target File
    20110820,20110822,140.13 ,0.000 ,E01,0
    20110820,20110822,103.80 ,0.000 ,E01,0
    20110820,20110822,142.58 ,0.000 ,E01,0
    20110820,20110822,88.70 ,0.000 ,E01,0
    20110820,20110822,151.92 ,0.000 ,E01,0
    20110820,20110822,91.47 ,0.000 ,E01,0
    Thaks..

    Hi lizcam,
    A. Use FCC at sender side, it will convert CSV to XML like this
    Input XML
    <documentName>
    <recordset>
    <record>
      <Time>20110820</Time>
      <ID>220DNE0220</ID>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    </documentName>
    Create a target DT like this
    Output XML
    <recordset>
    <record>
      <StartTime>20110820</StartTime>
      <EndTime>20110822</EndTime>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    In MM,
    1.Time -> CopyValue[0] -> StartTime
    2.Time -> below UDF -> EndTime
    3.Quan -> Quan
    4.Volume -> Volume
    5.Auc -> Auc
    6.No -> No
    UDF u2013 Execution type u2013 All values of Queue
    public void getLastTimeValue(String[] inputEndTime, ResultList result, Container container) throws StreamTransformationException{
    result.addValue(inputEndTime[inputEndTime.length-1]);
    B. At receiver use again FCC to convert XML to CSV.
    FYI. If you want to optimize more, you can use
    1.globalContainer concept OR
    2.u201CAttributes and Methodsu201D, declare are String. Store the EndTime using one UDF and write another UDF to retrieve it.
    Regards,
    Raghu_Vamsee

  • How to get the last record??

    Hi, I now have to get only the last record from one table
    from MS Access.
    I was looking for the useful method from API, however,
    I cannot get it.
    How to get only the last record from one table ???
    Please help, thanks.

    In RDBMS, row order is really not relavent by iteself. Meaning there is no such thing as 'last record' unless it's in the context of a column (e.g. timeStamp).
    Of course, rows are inserted and stored in some natural order, but you cannot assume they'll come back the same way in a 'Select *' as they were entered.
    So, if you mean last row as in last inserted row, I would add a timestamp field that's set at insert, or use a autonumber column. Either way, have a column that will always contain the highest number or newest timestamp, and then you can build your where clause from that.
    For instance, in Access, I have an autonumbered field called 'fred', with other columns. If I want the last record, I simply use the following:
    select * from atable where fred in (SELECT max(fred) AS Max FROM atable);
    the 'where in' clause will filter to only those records in the subsequent select statment, which of course is only one, the max of the column fred.
    bRi

  • How to get the last record of an internall table ....

    Hi All..
    i want to get the last record of an internal table itab, and i want the the value of the last record.

    Hi,
         Use describe statment.
    data: lv_line type i.
        Describe table itab lines lv_line.
        read table itab into wa_itab index lv_line.
    regards,
    Santosh Thorat

  • How to get the first and the last record of every month within a time range in sql

    I am trying to get the first record and the last record of each and every month in a given date range using sql. I have a sample code
    where i have just selected everything within the date range now i have to extract the first and the last records of each and every month.
    SELECT PurOrderNum,
    OrderDate
    FROM Purchasing.PurOrder
    WHERE OrderDate >= '2013-02-28'
    AND OrderDate <= '2014-12-29'

    SELECT PurOrderNum,
    OrderDate
    FROM
    SELECT PurOrderNum,
    OrderDate,
    MAX(OrderDate) OVER (PARTITION BY DATEDIFF(mm,0,OrderDate)) AS MaxDate,
    MIN(OrderDate) OVER (PARTITION BY DATEDIFF(mm,0,OrderDate)) AS MinDate
    FROM Purchasing.PurOrder
    WHERE OrderDate >= '2013-02-28'
    AND OrderDate <= '2014-12-29'
    )t
    WHERE OrderDate = MaxDate
    OR OrderDate = MinDate
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to restrict the last record and not moving to next reocrd

    1) how to restrict the last record and not moving to next reocrd.
    2) Also for the F6 key(for new record).

    When you are on the last record, next-record will create a new one, so that my question is do you want to forbid new record creation.
    Francois

  • How to fetch last record from the table to display in screen painter?

    Hi Gurus,
                  I have a requirement where i have to fetch the last record value in the table.
    I have a screen where the TEXT name is REQUEST and I/P field name is REQ and SAVE push button.
    In this I/P field automatically 1 should display when i excecute the program and when i save this, the request number should turn to 2 that is dynamically..once agin save then 3 and so on....and this 1, 2, 3 will be storeing in table.
    I have succeeded till generating the values dynamically and saving in the table like 1 is displayed and when i click save it is changeing to 2..but the problem is when i am coming out of program and logon again the request number is again displaying as 1 rather it has to start with 4 because already 3 request are there in the table.
    My code is...
    Table zsave.
    data declarations....
    data req type i.
    req = 0.
    req = zsave-req.
    PROCESS BEFORE OUTPUT
    req = 0.
    select req into table fun_st from zsave.
    req = zsave-req.
    zsave-req = req.
    req = zsave-req + 1.
    PAI
    req = zsave-req + 1.
    zsave-req = req.
    when 'save'.
    wa_funst-req = zsave-req.
    Please can you provide me with the solution....answer will be rewared.
    THKS

    Can you tell me, when updaing the ZSAVE table with the counter value are you modifying the exisiting value or inserting the value as new record?
    From the code in your first post, i see that you are extracting records into internal table but when you are moving to variable REQ, you are moving from table work area which is blank, so everytime when you execute it may be starting as 0.
    Hope below code can help you understand on handling your requirement
    Global Declaration:
    >DATA: l_req TYPE i. 
    PBO:
      SELECT MAX( req ) INTO l_req FROM zsave.
      l_req = l_req + 1.
    PAI:
      DATA: wa TYPE zsave.
      CASE ucomm.
      WHEN 'SAVE'.
        wa-req = l_req.
        INSERT zsave FROM wa.
      ENDCASE.

  • Master-Detail only shows the first record of the Master's data

    I have an ADF Master Table, Detail table. I use ExcuteWithParams on the Master Table. When executed from a button (Button has partial submit = true for button, Master Table has PartialTrigger on button, and Detail table has PartialTrigger on Master table and button), it works fine. However, I want to pass the parameters in pageFlowScope variables, and have the ExecuteWithParams invoked upon page load. When I try to do this, the Detail table only shows the first record of the Master's data, no mater what row is clicked on the Master table.
    Master table now has no PartialTrigger, and Detail table has PartialTrigger on Master table. In my pageDef, I used an invoke action as follows:
    <invokeAction Binds="ExecuteWithParams" id="invokeExecuteWithParams"
    Refresh="always"/>
    What am I missing? I am using verion 11.1.1.3. Any help would be much appreciated.
    Thanks,
    Jessica

    Yes, it works when I drag the data control as a master detail without filtering any data. I want the user to be able to set search criteria to filter the data in the master table (For example, only pull back data with a transaction date between :startdate and :enddate). I can get it to work if I execute from an executewithparams button on the page, but not if I want to invoke the executewithparams upon page load with the parameter set by pageflowscope variables.
    Thank you for responding.
    Jessica

  • How to show the content of a data object in listbox

    Hello together,
    i have created a service employee_srv for my data object "Employee". How can I show the content of this data object in a listbox in my view, for example DropDownByKey.
    Regards
    Waldemar Schakiel

    Hi,
    An example to create a dynamic context in Webdynpro ABAP:
    data:
    rootnode_info TYPE REF TO if_wd_context_node_info,
    dyn_node TYPE REF TO if_wd_context_node,
    tabname_node TYPE REF TO if_wd_context_node,
    tablename TYPE string.
    rootnode_info = wd_context->get_node_info( ).
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
    parent_info = rootnode_info
    node_name = tablename " Data object Table name
    structure_name = tablename
    is_multiple = abap_true ).
    ***Bind data to Dynamic table:
    DATA: stru_tab TYPE REF TO data.
    FIELD-SYMBOLS:
    <tab> TYPE table.
    create internal table
    CREATE DATA stru_tab TYPE TABLE OF (tablename).
    ASSIGN stru_tab->* TO <tab>.
    dyn_node = wd_context->get_child_node( name = tablename ).
    Bind internal table to context node.
    dyn_node->bind_table( <tab> ).
    Shruthi

  • How to write the java program to retrieve the last 7 days dates

    Hi,
    I am having requirement that how to write the java program to retrieve the last 7 days dates. Please help me.
    Regards,
    Ahamad

    It needs any jar file.Of course!
    I did using jscape.My program is running fine.But it
    requires jar file.Which is licensed version.Maybe you should follow the link the the 'license' on the site I posted!
    >
    I have the doubt is apache provides jar file free
    versionMaybe you should follow the link the the 'license' on the site I posted!

  • How to get the last record from the database

    I am using MS Access database and Swings as GUI. I want to get the last record of a particular column from the table and store it as a varaible.

    Hi
    To get Last record of resultset, you have pass some parameter in constructor of CreateStatement.In such case Resultset should be scrollable and Readonly
    Example
    objStatement=objCon.createStatement ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    mwwResultSet=cwwStatement.executeQuery(mwwSqlQuery);
    while(mwwResultSet.next())
    if(mwwResultSet.isLast())
    //Fetch the required column record.
    String abc=mwwResultSet.getString(1);
    I think this will work. Try it.
    bye

Maybe you are looking for

  • Stored Procedure for UDO

    Hi All!!! ) May my question be silly to u...But kindly share ur ideas in the following concept to throw light in my perspective... We dont go with SDK (Not at all using it). We being in mid of a R&D. We hav created a UDO. the table contains some fiel

  • Back facing camera doesn't work!

    My back facing camera on my ipad2 doesn't work. The shutter will not open to take pics or video. I have tried rebooting iPad and resetting it and nothing works! I was hoping for an at home fix instead of sending it in cause I'm afraid to lose some ph

  • Manage devices

    I have 4 devices macbook, macbook pro, imac and iphone 3GS, apps sync from icloud to each device but in my account only shows 2 are authorised and showing in "manage devices", macbook pro and imac. Can anyone point me in the right direction please???

  • After migrating to new MBP have two versions of GarageBand

    Just finished migrating to my new MBP from an older MBP.  I had the latest version of GB on the older machine.  After completing the migration, found two copies of GB on the new machine.  One is the latest version, 10.0.1 and the other is GB '11 (V 6

  • Glossy or Matte? about to make the leap, need advice ...

    I am about to finally make my much anticipated leap into the world of well, you know ... The plan is to order a 17" MBP, 2.6GHz, 200GB 7200, enhanced rez, mostly for photoshop CS3 and graphics design, and the question is: glossy or matte? All timely