Getting the last date's value

Hello,
I need to be able to show the last date's value for all dates where a fact measure exists.
For example, let's say I have the following fact table:
Date                  Category  Value
01/01/2000       A              1
01/02/2000       A              3
01/03/2000       B              2
01/05/2000       C              7
What I need is to have a calculated measure that shows the last entry while respecting the value of the category in the slicer. So if I have no category in the slicer, the pivot table looks like this:
Date                  Value  Calculated Measure
01/01/2000       1         7
01/02/2000       3         7
01/03/2000       2         7
01/05/2000       7         7
But, if I have a category A in the slicer, it should look like this:
Date                  Value  Calculated Measure
01/01/2000       1         3
01/02/2000       3         3

Assuming you only have a single table in your data model like your example, this measure should work for you with Category as a row or a slicer:
=CALCULATE(
   LOOKUPVALUE(TableName[Value],
     TableName[Date],
     MAX(TableName[Date])
   ALLEXCEPT(
       TableName,
       TableName[Category]
Replace TableName with the actual table name.

Similar Messages

  • Get the last date of a given date...

    Hello experts,
    How do I get the last date of a given date? for example:
    20060615  "June 15,2006
    So I want to get the last date of june so that will be
    20060630
    But I want to make it this way:
    06/30/2006 because I will use it in my where clause.
    Again, thanks a lot guys and take care!

    The date format should be in 'YYYYMMDD'
    data : v_last_day like sy-datum,
    v_in_date like sy-datum.
    v_in_date = '20050109'.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
    EXPORTING
    DAY_IN = v_in_date
    IMPORTING
    LAST_DAY_OF_MONTH = v_last_day
    * EXCEPTIONS
    * DAY_IN_NO_DATE = 1
    * OTHERS = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write : / v_last_day.
    Cheers
    VJ

  • Please help.........how can i get the last date of the month?????

    Hello....
    I want to get the last date of the month.
    For example, the last date of Jan is 31.
    How can I get the last date of the particular month and year ????
    Thanks for help.
    Gloria

    Hi Gloria
    1. How can I compare the date???date1.compareTo(date2)
    where date1 and date2 is a java.util.Date Object
    will return 0 if it is the same date
    or
    date1.after(date2)
    where date1 and date2 is a java.util.Date Object
    will return true if date1 is after date2
    (the same for date1.before)
    2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
    new SimpleDateFormat("yyyymmdd").format(yourdate)
    Hope this help.
    Please also have a look at a calendar I wrote, (maybe it help)
    demo & source :
    http://www.geocities.com/globe_software/java/components/
    globe_sa

  • Getting the last date

    Hello,
    I need to be able to show the last date's value for all dates where a fact measure exists.
    For example, let's say I have the following fact table:
    Date                  Value
    01/01/2000       1
    01/02/2000       3
    01/03/2000       2
    01/05/2000       7
    What I need is to have a calculated measure that shows the last entry, so that when I have the pivot table, it looks like this:
    Date                  Value  Calculated Measure
    01/01/2000       1         7
    01/02/2000       3         7
    01/03/2000       2         7
    01/05/2000       7         7

    Hi Kostaz,
    You could try defining a calculated column...I've called this 'Calculated Column' in my example:
    =
    CALCULATE(
    MAX(Data[Value]),
    FILTER(
    Data,
    Data[Date] = MAX(Data[Date])
    Then you can use a measure to return the MAX value:
    Calculated Measure:=MAX([Calculated Column])
    Regards,
    Michael
    Please remember to mark a post that answers your question as an answer...If a post doesn't answer your question but you've found it helpful, please remember to vote it as helpful :)

  • How to get the last data point from a TDM file in LabVIEW?

    Hello,
    I am using LabVIEW to analyze some rather large TDM files, and I need a way to get only the last data point.  So far, the only way I have been able to accomplish this is by reading the entire file.  Is there a property in the TDM file or a function in LabVIEW that will allow me to get the index of the last item in a channel?  
    Thanks!
    Christina

    Do you want to avoid reading whole file and want to be able to reach or get the index of last value of channel? is there any specific reason? I am not sure you could do it without loading the whole file. But the easiest way would be just to use array functions "array size" would give you the index of last element. 
    -Nilesh
    Kudos are (always) welcome for the good post. :-)

  • How do I get the last or maximum value /

    Hi all,
    I got the following query output :-
    ITEM_______DATE____________PRICE
    AAA_______01/11/04__________2.5
    AAA_______22/04/05__________4.0
    BBB_______04/08/05__________44
    BBB_______05/08/05__________45
    CCC_______04/12/04__________12
    CCC_______05/05/05__________90
    I want to get the output of the last date, I'm try to use max(date), however, b'cos of the diff price the records still show. I just need the output of the last date, output will be something like below :-
    ITEM_______DATE____________PRICE
    AAA_______22/04/05__________4.0
    BBB_______05/08/05__________45
    CCC_______05/05/05__________90
    How should I code ?
    Rgds
    Lim

    SQL> drop table test_data
      2  /
    drop table test_data
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> create table test_data
      2  (item       varchar2(32)
      3  ,item_date  date
      4  ,price      number)
      5  /
    Table created.
    SQL>
    SQL> insert into test_Data values('AAA', to_Date('01/11/04', 'dd/mm/yy'),2.5)
      2  /
    1 row created.
    SQL> insert into test_Data values('AAA', to_Date('22/04/05', 'dd/mm/yy'),4.0)
      2  /
    1 row created.
    SQL> insert into test_Data values('BBB', to_Date('04/08/05', 'dd/mm/yy'),44)
      2  /
    1 row created.
    SQL> insert into test_Data values('BBB', to_Date('05/08/05', 'dd/mm/yy'),45)
      2  /
    1 row created.
    SQL> insert into test_Data values('CCC', to_Date('04/12/04', 'dd/mm/yy'),12)
      2  /
    1 row created.
    SQL> insert into test_Data values('CCC', to_Date('05/05/05', 'dd/mm/yy'),90)
      2  /
    1 row created.
    SQL>
    SQL> select * from test_Data
      2  /
    ITEM                             ITEM_DATE      PRICE                                              
    AAA                              01-NOV-04        2.5                                              
    AAA                              22-APR-05          4                                              
    BBB                              04-AUG-05         44                                              
    BBB                              05-AUG-05         45                                              
    CCC                              04-DEC-04         12                                              
    CCC                              05-MAY-05         90                                              
    6 rows selected.
    SQL>
    SQL> select * from test_data
      2  where (item_date, item) in
      3  (select max(item_date) item_date, item from test_Data group by item)
      4  /
    ITEM                             ITEM_DATE      PRICE                                              
    AAA                              22-APR-05          4                                              
    CCC                              05-MAY-05         90                                              
    BBB                              05-AUG-05         45                                              

  • How to Get the last data dymanic

    in my bussiness scenarios,I have a cube store some data by month
    but some material have no records in some month
    I need to check if this month have records,get it
    or if there is no records, get the last records by month
    how can i do this?

    You check in R3...whether you have material data for that month...if yopu have data, in BW, run a repair full request by giving this criteria i.e. month criteria.
    Thanks...
    Shambhu

  • How to get the last inserted Autoincrement value in Java for Pervasive DB

    Hi, I need to get the last inserted auto incremented value after the record is inserted IN JAVA For ex. consider we have 4 columns for the myTable in the PERVASIVE DATABASE V10 autoid - identity column (auto increment column) userID userName pageID insertSqlExpression = insert into myTable (userID , userName, pageID) values( ? ,? ,?); prepareInsert = connection.prepareStatement(insertSqlExpression); prepareInsert .excuteUpdate; After inserting the new record how can I get the autoid value (last inserted value) in the Java. Please help me.
    Thanks in advance. Arthik

    JavaArthikBabu wrote:
    I dont have privileges to write new stored procedures in database.I need to do in the Java side only. In many databases that irrelevant. The same way you would do it in a proc can be done with the correctly conceived statement (singular.)
    For ex &#150; if we insert and then the select record's identity value as a single transaction and would this guarantee that what is returned by the select would not include inserts that another might have made?Please do not take that path unless you are absolutely certain that your database does not support any other way to do it.

  • How to get the last date of that month after adding the two month.

    Hi,
    I have a requirement, My input is month/lastdate of the month/year after adding 2 months i want the same format mont+2/lastdate of the month/year.
    Please let me know the exact FM for this.
    I have check this FM RE_ADD_MONTH_TO_DATE.
    Input:                                           
    Import parameters               Value    
    MONTHS                          02       
    OLDDATE                         02/29/2008
    Output:                                           
    Export parameters               Value     
    NEWDATE                         04/29/2008
    But this wrong because i am expecting the last date of the April.
    2) I have checked another FM that also also shows the wrong output: RP_CALC_DATE_IN_INTERVAL                                                
      Import parameters               Value         
      DATE                            12/31/2008    
      DAYS                            00            
      MONTHS                          02            
      SIGNUM                          +             
      YEARS                           00                                                                               
    Export parameters               Value         
      CALC_DATE                       03/01/2009    
    Thanks In avance,
    Thanks & Regards,
    Venkata

    Hi,
    do the RE_ADD_MONTH_TO_DATE then
    Plug the result date into FM RP_LAST_DAY_OF_MONTHS
    Regards
    Stu

  • To get the last date of year

    Can anyone tell me how to get last date of the year while passing the First date of year:
    My below query is giving the last date of the month
    SELECT LAST_DAY(ADD_MONTHS(TO_DATE('01/01/2012','DD/MM/YYYY'),12 -
    TO_NUMBER(TO_CHAR(SYSDATE,'mm')))) FROM DUAL
    Thnx in Advance

    jeneesh wrote:
    Last date will be always 31st december..
    to_date('3112'||to_char(first_date,'yyyy'),'ddmmyyyy')
    I like that !!! :)
    I guess, OP will have to either Buy a New Calendar or Prepare on where the Last Day of year is not 31st December. ;)

  • Report req -To get the last date

    Hi all,
    I have  one report requirement,I have to develope the report to display last movement date.
    I am able to get the all movement dates regarding the particular material.But I need to display only last date .Is any option in query designer to get last date only in report .Instead of displaying all dates like MAX of the date in our abap code.
    Thank's
    BK

    Hello Srini / Tarak
    Thank you I will try your options .But I dont have any direct keyfigure like : last movement date.
    I have to do all cal on my date characteristic only.In this regard please suggest...
    Thanks
    Bk

  • Mdx query to get the last date of every month if the month is current month need current date..

    i have a scenario where i need the data of last date of every month and if the month is current month need current date data...
    is it possible using MDX...

    Hi Shashi,
    According to your description, you want to return the last day for each month except current month, right?
    In MDX, we can use ClosingPeriod function to return the member that is the last sibling among the descendants of a specified member at a specified level, here is a sample query for you reference.
    with member [measures].[a]
    as
    ClosingPeriod ([Date].[Calendar].[Date],[Date].[Calendar].currentmember).name
    select {[measures].[a]} on 0,
    [Date].[Calendar].[Month].members on 1
    from
    [Adventure Works]
    And then use the IIF function to evaluate if the month is current month. Please refer to the links below.
    http://msdn.microsoft.com/en-us/library/ms145584.aspxhttp://msdn.microsoft.com/en-IN/library/ms145994.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to get the last sub folder value from the string in Webi report

    I have an object coming from universe, this object will contain string e.g. \\Users\Public\Pictures\Sample\
    or    \\Users\Doc\BI\BO\Webi\
    I need the last sub folder from this path to be displayed i.e. Sample and Webi.
    I would like to know how it can be done.
    I tried using formulas like POS, SubStr and Length. however the issue is that the length of the the sting is not fixed and the number of "\" are also not fixed.
    I would appreciate any help regarding this.
    Regards,
    Yogesh

    Hi,
    What is the formula you have written though?.
    =length(right([folderpath]);pos([folderpath];"\")+1)
    Thanks,
    Jothi

  • First I had the last date up and now all of a sudden stands the last date under the list of incomming emails how can I get the last date again up the list

    I hope you understand what I mean because English is not my language but Dutch.
    Example: 17-11-2014
    16-11-2014
    15-11-2014 so I recieved my e mails and now
    15-11-2014
    16-11-2014
    17-11-2014
    and I want that the newest date become up
    I hope their is someone to help me.
    Thanks.
    Heinja

    In English: ;-)
    Click on "Date" to sort by date. Click it again to reverse the sorting.
    Or, in the menu, '''View|Sort By''' and select '''Date''' and '''Ascending '''or '''Descending '''as you require. You probably want '''Unthreaded''' too.

  • How to get the local date time value

    Hi,
    I am Australian time zone. I have been using the below code to retrieve meeting start date time from my Sharepoint Calendar.
    Console.WriteLine((DateTime)oListItem["EndDate"]);
    This used to return the correct local date up until today. I simply read this and store in a database. Today when I check I can see that the date returned is different to what I can see in the Sharepoint calendar.
    For and example: In Sharepoint calendar I can see the date as "Oct 1 2014 5:30 PM". But my above code now returns "Oct 1 2014 6:30 AM". This looks to me like UTC time.
    But up until today my code above returned the correct local date. Is there any reason for this sudden chahge?
    When I read the TimeZone in sharepoint (using RegionalSettings.TimeZone method) it return the correct time zone too.
    Any help would be appreciated. I am concerned that I have to now go and change all places where I read the date time from sharepoint.
    Thanks, Bimal
    Bimal

    Hi,
    According to your post, my understanding is that you had some issue about the calendar time.
    As your code worked well before, the issue may be related to the calendar itself or the site.
    As the TimeZone is correct, you can recreate a new calendar to check whether it works.
    Or create a new site to check whether it works.
    I had made a simple demo to retrieve the calendar EndDate time, you can also check with it.
    using (SPSite site = new SPSite("http://YourSiteURL "))
    using (SPWeb web = site.OpenWeb())
    SPList spList = web.Lists.TryGetList("Calendar1");
    if (spList != null)
    SPQuery qry = new SPQuery();
    qry.ViewFields = @"<FieldRef Name='EventDate' /><FieldRef Name='EndDate' />";
    SPListItemCollection listItems = spList.GetItems(qry);
    foreach (SPListItem item in listItems)
    string startTime = item["EventDate"].ToString();
    string endTime = item["EndDate"].ToString();
    Console.WriteLine("Start Time:"+startTime);
    Console.WriteLine("End Time:"+endTime);
    Thanks,
    Jason
    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]
    Jason Guo
    TechNet Community Support

Maybe you are looking for

  • ITunes Store will not load in iTunes 11.0.1

    I have tried all the suggested tips but the store will NOT load with 11.0.1 any ideas are most welcome.  iTunes works fine in all other aspects.  I am using Mac OS X 10.7.5.

  • Hard drive full even though it's not.

    Don't have much on my mac but in the HD info it says i have 616 kb left which is obviously nothing. Even when i delete files and empty trash it returns to 616kb even though I've deleted stuff. Seems something is returning the remaining space to 616kb

  • ABAP Webdynpro Initial setup

    HI, I am doing an ABAP Webdynpro application. Everything is doing fine but not able to see the output. I think some initial setup is required to connect the server or to see the output. Can anybody tell me the setup details. plz help...............

  • Page cannot be displayed error when login to EBS home page

    Hi All, I have some problem login to EBS page, if only one responsibility is active to user it will get error Page cannot be Displayed error 404 on the Main Menu. However if 2 or more responsibilities are active no error will come up and it will show

  • Issue Binding remote computers

    OK, have Advanced Leopard Server running, DNS and Open Directory setup. Can Bind local computers. Tried binding remote computers and does not see/find server in Directory Utility... yet I can sign in and mount NFS shares. Does a specific port need to