Most recent date with two other conditions met

Ok, so I'm sure somebody is going to suggest that I do a search first before posting on here.  So let me assure you, that I have exhausted all search possibilities that I could possibly think of before registering to post on here.  I've read a lot of good suggestions that got me just as far as I was getting on my own, because I couldn't find any posts of somebody asking exactly what I'm looking to do.  I have tried quite close to 100 different formulas without achieving the desired results.
I'm a pilot, and I track all of my flights myself in a very well organized(I think so ) Numbers spreadsheet that I've been tweaking and perfecting over the past few years.  I have created plenty of formulas in it, and they all work great...except ONE.
I've created a simplified version of the columns I am trying to match specific conditions with.  Essentially, I need the formula to return the most recent date(column 1), that is completed during a night time flight status(column 2), that is equal to or greater than 1.0 flight hours(column 3).
As you can see, by evaluating the table below, the correct formula should return to me:        8-4-13
The closest I've come to getting the correct results was with a "LOOKUP" formula, but I could not figure out how to get it to properly assess whether it was equal to or greater than 1.0 hours of flight, thus returning me the wrong date EVERYTIME(the most recent night flight period).
I'm sure I've gotten close at least a few times, but I need some help getting this final formula figured out.  I really appreciate anybody's input on this.
Date
Flight Status
Flight Hours
8-1-13
D
2.4
8-2-13
N
3.0
8-3-13
N
1.1
8-4-13
N
1.3
8-5-13
D
2.2
8-6-13
N
0.5
8-7-13
D
1.1

This may work and requires and extra column in your Data entry table (the one you provided in your post).  You can hide this new column.
D2=IF(AND(C2>=1, B2="N"), A2, "")
select D2 and fill down as needed.
The table on the right is a summary table and is set up as follows:
B2=MAX(Data :: D)
I hope this is helpful

Similar Messages

  • Previous month is easy, what about most recent date WITH data?

    As the topic suggests, I've seen many posts with the following solution for returning the last date of the previous month: TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, CURRENT_DATE)).
    However, for at least the first few days of the current month, no data will be available for the previous month. How can I tell OBIEE to return the date for the most recent month where data exists?
    Another part of this puzzle, is that this request needs to play nicely with query rewrite in the view. the TIMESTAMPADD doesn't seem to use query rewrite well. Any suggestions?

    jzuzphreek wrote:
    As the topic suggests, I've seen many posts with the following solution for returning the last date of the previous month: TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, CURRENT_DATE)).
    However, for at least the first few days of the current month, no data will be available for the previous month. How can I tell OBIEE to return the date for the most recent month where data exists?
    Another part of this puzzle, is that this request needs to play nicely with query rewrite in the view. the TIMESTAMPADD doesn't seem to use query rewrite well. Any suggestions?For what you presented, the answer is simple. However, I suspect that your need is not as simple as you described. You describe your scenario as "there are no data for the previous month for the first few days of the current month." There are two inherent assumptions which if true, makes the problem not that difficult:
    1) Only the first few days of the current month, there are no data for the previous month (i.e., for the rest of the month, the data are there.)
    2) Data exists for every month.
    With these two assumptions, here is how you build your dashboard.
    1) Create a simple report with the key data fields run with the filter for "current month."
    For the "first few days" of the current month, this report will yield no records. (It doesn't matter how many days "a few days" is as you will see.) For the "rest of the month," this small report will always yield at least one record.
    2) Create your main report (call this Report A) that has a filter for "previous month."
    3) Place Report A on your dashboard in a Section.
    4) Click on the Properties of the Section and select "Guided Navigation" and have it point to the small report you built in step 1) that will display the section "if the request returns rows."
    5) Build another report (call this Report B) that has a filter for "two months ago."
    6) Place Report B in a separate Section on your dashboard, below the Section in step 3).
    7) Click on the Properties of this Section and again select "Guided Navigation," have it point to the small report from step 1), but this time have it display "if the request returns no rows."
    So here's what happens. For the first few days of "this month," the small report will return no rows. The top Section will not display, but the bottom one will, which has as its filter "two months ago." The assumption is that by the end of each month, there will always be data. This therefore meets your criteria of displaying "the most recent month where data exists." Once data for "this month" is available, the top Section will display with the current month's filter. The bottom section will not appear until the "first few days" of the next month.
    That's how you do it.

  • How to display record with most recent date in sapui5?

    Hi
    I have a local json data with me, in which I have number of records.
    And in each record I have an "AENDATE" as a date property.
    Now I want to display the record with most recent date in the records.
    How I can I do it......????????
    Please help me with this.
    Thanks
    Sathish

    How about sorting your json model descending, and display only first (index:0) item?

  • Highlighting the most recent date in a row

    hi all
    I have a series of 5 dates in a row. I would like to be able to highlight only the cell containing the most recent date (in respect to the current date) in each row.
    There will be instances when there is no date in some of the cells.
    Thanks for the help in the past, this and the other forums are awesome.

    Jason is correct. It requires two tables.
    I had started experimenting with this last night, but an outage at my ISP prevented posting at that time.
    Conditional formatting of a cell depends on comparing the value in that cell with a fixed value contained in the rule; the rule itself cannot reference a different cell to pick up the comparison value. So you need to calculate a value in a cell on a second table, apply conditional formatting to that cell, and place it directly behind the cell containing the date to be highlighted.
    Example:
    Dates are in cells B7 to F7 of Table 1
    Cell H1 is used to select the maximum date.
    Table 2 is a single row table with no row or column header cells, and only 5 columns.
    Select Table 1, open the Inspector, and use the Table inspector to set Cell Background to “None”
    In Cell H1 enter: =MAX(B7:F7)
    Go Insert > Table > Plain
    Resize the new table (Table 2) to 1 row x 5 columns.
    In A1 of Table 2, enter: =DATEDIF(Table 1::B7,Table 1::$H7,"D")
    Drag the handle at the lower right of the cell to copy the formula into all five cells.
    Click on A1.
    Open the Inspector and choose the Cell Format inspector.
    Check the Conditional Format checkbox, then click Show rules...
    Set the rule to “Equal to... 0”
    Choose a Fill colour to serve as your highlight colour.
    Click on the next cell and repeat.
    When you have applied the rule to all five cells, close the Conditional Format dialogue.
    Choose all five cells. Open the Text inspector.
    Click on the colour well.
    Leave the text colour set at Black, but move the Opacity slider to 0%.
    Close the Inspector and the Colors dialogue.
    Select Table 2 and drag it into position covering the five cells with dates on Table 1. Use the Arrow keys to nudge it into exact alignment.
    Go Arrange > Send Backward to move Table 2 behind Table 1. Repeat until you can see the dates on Table 1.
    Regards,
    Barry

  • How to display maximum (most recent) date value in a query

    hello,
    I have the following query:
    StudentNumber | ExternalOrganization | Date |         | NumbeOfAdmissions
    0112                  050                            06/27/2007   1
    0234                  060                            07/15/2008   1
    1356                  025                            01/08/2008   1
    My dilemma is how to display only the row that has the most recent Date, e.g. here I want to only see the row with student number 0234 and date 07/15/2008; everything else should be hidden.
    I know it should be very simple....yes/no?
    thanks

    Hi
    even I am facing the same problem..
    Can you please tell me what did you do to get most recent record..
    Even I have made my date field as KF.. n have put condition on it.. but not getting desired result.. may be I am missing something.. somewhere..
    I resolved it.. thanks
    Regards
    Swati
    Edited by: Swati on Feb 17, 2009 7:49 AM

  • Most recent date (UDATE) from CDHDR table based on CDPOS

    Hi,
    I am working on one object where i stuck with one issue. The requirement is I have to retrieve the most recent date from CDHDR table based on CHANGENR in CDPOS table. Where i am doing FOR ALL ENTRIES on CDPOS table to get the MAX( date )and i got the error, that aggregate functions are not allowed except COUNT( * ) with for all entries.
    Any thread which can solve this issue would help aswel.
    Please guide me how to achieve this. <removed>
    Edited by: Thomas Zloch on Mar 13, 2010 9:10 PM

    Hi Li,
    Thats was really helpful information , infact my requirement is same as what you said. I even checked in the table entries there is only one changenumber.
    You said we can take the first record, i even did the same. But for TABNAME I have to pass 3 table name 'LFA1', 'LFB1' and 'LFM1'. For FNAME 'LOEVM', 'SPERR'. I have written the code as below.
      SELECT objectclas
                   objectid
                   changenr
                   FROM cdpos
                   INTO TABLE i_cdpos_a1
                   FOR ALL ENTRIES IN i_lfabm1
                   WHERE objectclas = c_kred               "KRED
                   AND objectid EQ i_lfabm1-objectid       "Lifnr
                   AND ( tabname EQ c_lfa1 OR tabname EQ c_lfb1 OR tabname EQ c_lfm1 )          "LFA1, LFB1 and LFM1
                   AND ( fname EQ c_loevm OR fname OR fname EQ c_sperr )    "LOEVM, SPERR
                   AND value_new EQ c_x.
            IF sy-subrc EQ c_0.
              IF i_cdpos_a1[] IS NOT INITIAL.
    Select UDATE from CDHDR based on CHANGENR in CDPOS.
                SELECT objectclas
                       objectid
                       changenr
                       udate
                       FROM cdhdr
                       INTO TABLE i_cdhdr_a1
                       FOR ALL ENTRIES IN i_cdpos_a1
                       WHERE objectclas = c_kred             "KRED
                       AND  objectid EQ i_lfabm1-objectid               "Lifnr
                       AND changenr EQ i_cdpos_a1-changenr.   "(this is coming from CDPOS above selection)
    Here i got UDATE which have all the dates from 3 tables. I have to display in the output the field value (X) of LOEVM and UDATE for LFA1, SPERR value and UDATE for LFA1.Same way for other two tables, I have to display the UDATE and its field value (X). Where UDATE should be most recent date respectively.
    How can I populate the Recent date (UDATE) from one interal table for indvidual field values and table names.

  • Selecting row by most recent date

    I'm attempting to select a row where the time ends in :00 and
    date is the most recent date or just the last record where time
    ends in :00, either will do.
    Once I have that record selected I need to query that query
    to pull in the previous 3 records which will be times ending in
    :15, :30 and :45 to round out that full hour of data for
    processing.
    It seems to me that this should be pretty easy but my CF
    books are not helping me here.
    Any Ideas?

    Two things I do to make this sort of thing easier are:
    1. Take baby steps. Start with one field and the date field.
    Once you get that to work, add one or two fields at at time.
    2. Comma control. This structure helps prevent extra commas
    from slipping into your query.
    select field1
    , field2
    , date
    from yourtable join (
    select field1 f1
    , field2 f2
    , max(datefield) maxdate)
    from yourtable
    where something
    group by field1
    , field2
    ) temp on field1 = f1 etc
    where clause

  • Select most recent date only

    I'm quite new to discoverer so please bear with me.
    I have a query that returns e.g. 16 records.
    One of the fields is a date field.
    What I want to do is put a condition on the date field so that it only returns the record with the most recent date.
    Thanks.

    let me explain it to u in detail
    i have the following fields
    CONTRACTNUM FIRMTYPE FIRM A FIRM B FIRM % NTP_ACTUAL
    123456 P ABC XXX 96 MM/DD/YYYY
    S XXX DEC 4 MM/DD/YYYY
    P ABC XXX 96 MM/DD/YYYY
    S XXX DEC 4 MM/DD/YYYY
    Here the CONTRACTNUM IS unique and the firm% sum is equal to 100, but the record is repeating twice , under the same CONTRACTNUM......................any suggestions willbe of great help.
    So for this i used the ROW_NUMBER() OVER(ORDER BY date_field DESC)
    in my case : ROW_NUMBER() OVER(ORDER BY ntp_actual DESC).
    Now it gives me a new field with the row_numbers and when i create a condition where the calculation is =1, it give me one record
    I was using this , because for any given contract number .............it should bring the record with the recent ntp_actual date.
    i hope i was clear.
    Thnks

  • "next" most recent date

    Hello!
    I have an order header record with a order line detail table.
    ORDERS
    OrderID > 1
    ORDER_LINES
    orderID1, line1, item1, date_due
    1,1,ITEM1,01-MAR-07
    1,2,ITEM2,15-MAR-07
    1,3,ITEM3,01-ARP-07
    I want to select the single next most recent date from order_lines where the date_due is the next future date closest to sysdate. There could also be several lines with dates beyond that, but I'm only interested in the next most recent line.
    For the example above, if sysdate = 03-MAR-07 the query would return order 1, line 2 (with the date of 15-mar-07).
    I've seen example in the forum with max(), however as pointed out, there could be several future line dates out there, I'm only interested in the next one from the current sysdate.
    In addition there could be no lines at all that map to the order id, requiring a NLV type of test output.
    Thanks!

    Maybe like this?
    SQL> select * from order_lines;
                ORDERID1                LINE1 ITEM1      DATE_DUE
                       1                    1 ITEM1      01-MAR-2007
                       1                    2 ITEM2      15-MAR-2007
                       1                    3 ITEM3      01-APR-2007
    SQL> select *
      2  from
      3  (
      4     select ol.*
      5           ,dense_rank() over (partition by orderid1 order by date_due) dr
      6     from   order_lines ol
      7     where  date_due > trunc(sysdate)
      8  )
      9  where dr = 1;
                ORDERID1                LINE1 ITEM1      DATE_DUE                      DR
                       1                    2 ITEM2      15-MAR-2007                    1

  • Select most recent DATE for an ID.

    Hi All,
    I need to SELECT the records with the most recent DATE for each ID. A DATE range is part of the selection criteria.
    My data.
    MY_ID MY_DATE
    1684662 26-JAN-09
    1424097 27-JAN-09
    1684663 27-JAN-09
    1684664 27-JAN-09
    1684672 28-JAN-09
    0689073 28-JAN-09
    1052476 21-JAN-09
    1052476 21-JAN-09
    1360828 23-JAN-09
    1684661 23-JAN-09
    1052476 30-JAN-09
    1052476 30-JAN-09
    1052476 30-JAN-09
    1052476 30-JAN-09
    The code below works fine when selecting 1 ID in the SUBSELECT, but with multiple ID it still selects rownum=1 (of course). This as far as my thinking takes me.
    SELECT my_id,
    my_date
    FROM
    (SELECT my_id,
    my_date
    FROM my_table
    ORDER BY my_date DESC
    WHERE rownum = 1
    AND *{color:#ff0000}my_id = 1052476{color}*
    AND TO_CHAR(my_date,'YYYY/MM/DD') BETWEEN '2009/01/01' AND '2009/01/31';
    If I could somehow pass the SELECT ID into the SUBSELECT WHERE clause I should have this done.
    Any suggestions?
    Thank You in Advance for Your help,
    Lou

    One of many possible soultions.
    ME_XE?with data as
      2  (
      3     select 1684662 as id, to_date('26-JAN-09','dd-mon-yyyy') as the_date from dual union all
      4     select 1424097 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      5     select 1684663 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      6     select 1684664 as id, to_date('27-JAN-09','dd-mon-yyyy') as the_date from dual union all
      7     select 1684672 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      8     select 0689073 as id, to_date('28-JAN-09','dd-mon-yyyy') as the_date from dual union all
      9     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
    10     select 1052476 as id, to_date('21-JAN-09','dd-mon-yyyy') as the_date from dual union all
    11     select 1360828 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
    12     select 1684661 as id, to_date('23-JAN-09','dd-mon-yyyy') as the_date from dual union all
    13     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
    14     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
    15     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual union all
    16     select 1052476 as id, to_date('30-JAN-09','dd-mon-yyyy') as the_date from dual
    17  )
    18  select id, the_date
    19  from
    20  (
    21     select id, the_date, max(the_date) over (partition by id) as max_the_date
    22     from data
    23  )
    24  where the_date = max_the_date;
                    ID THE_DATE
                689073 28-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1052476 30-JAN-0009 12 00:00
               1360828 23-JAN-0009 12 00:00
               1424097 27-JAN-0009 12 00:00
               1684661 23-JAN-0009 12 00:00
               1684662 26-JAN-0009 12 00:00
               1684663 27-JAN-0009 12 00:00
               1684664 27-JAN-0009 12 00:00
                    ID THE_DATE
               1684672 28-JAN-0009 12 00:00
    12 rows selected.
    Elapsed: 00:00:00.03

  • Most recent data first in table view

     I am adding values to a display table like in the example, but I want the top row to be the newest data for the user to see. 
    It keeps adding to the bottom, and then the user would have to scrolll down to see all the data.      Can I select somehow the most recent data or get the table to auto scroll as data is applied?     I have tried shift registers as well but no luck.        
    Here is my VI
    Thanks
    Mike
    Solved!
    Go to Solution.
    Attachments:
    BasicTableExample.vi ‏11 KB

    Be aware that if you populate the table with a lot of data, its performance will get very slow.  You can work around this issue by only writing data to the table which the table is actually displaying.  To do this, you will need to use a scroll bar separate from the main table and the event structure to capture events.  If you run into this issue, let us know so we can provide some sample code.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Most recent data on MultiProviders?

    Hey all,
    is there any chance to get the "most recent data" also on Multiproviders?
    In the moment, we got a query on one of our cubes showing the most recent data (latest request id) using the SAP-exit 0S_RQMRC.
    We now want to move the query on a corresponding Multiprovider. But the exit isn't working on Multiproviders. So is there a possibility to get this working?
    Waiting for your answers,
    Regards,
    bivision

    Hi
    Whatever standard variables ...whereever you can use its not a problem.but in your case it seems to be some problem with multi provider try to apply the Note for related to multi provider settings it may help you .
    Regards,
    Chandra.

  • Most recent date in report filter.

    Hi,
    I have a report with a date column. I would like to run the report for the most current date. I would like to add a filter to the report which pulls data for the most current as of date. Which would be the best method to use in the filter. Please advise. Thanks.

    First, you need to determine what the date column is that contains the dates you want to filter on. So say you have a Processing Date column which houses the dates transactions are processed.
    1) Add this date column to your workspace.
    2) Click on the filter button of this column and then on Advanced>Convert this filter to SQL.
    3) After the name of the column, enter MAX(date_column). So you will have:
    "Table name"."Date Column" = MAX("Table name"."Date Column")
    Now chances are you will have many reports that need the "most recent date" filter. Therefore, what you should really do is build this filter in the repository and expose it as a Saved Filter for all to use.

  • I have a serious (and bizarre!) issue with my novation impulse (Although i've tried it with two other keyboards and i still have the same problem) and its compatibility with mainstage 3

    i have a serious (and bizarre!) issue with my novation impulse (Although i've tried it with two other keyboards and i still have the same problem) and its compatibility with mainstage 3.
    the problem is best explained on the following one - page thread: 
    https://discussions.apple.com/thread/3951518?start=0&tstart=0
    (Clearly i'm not alone in this problem, although i think i figured out what's going wrong a little more than he did...read on!)
    his solution, to put mainstage in jump mode, is very unsatisfactory to me, as it bounces all of a sudden to drastically different settings.
    basically, my analysis is that my controller is NOT receiving MIDI date from mainstage.  in other words, mainstage knows what my controller is doing, but my controller doens't know what mainstage is doing.
     let's say i turn the knob all the way to the right ... 127...and the virtual fader goes to the right like it's supposed to. 
    now...next...let's say i change to a different patch, where that same VIRTUAL fader is not at the max clockwise position..maybe it's only at 1pm.  now when i turn the physical knob to the RIGHT, the midi data is still at 127 on the controller!  it didn't "reset" to sync up with the new level (say 80 or so) setting on the new patch.  so i can't increase that new setting of 80 by continuing to turn the knob to the right.  i have to turn it all the way to zero,...and then continue PAST zero until the controller thinks that IT is at 0...at that point the controller and mainstage are in agreement, and things work fine....so bascially, the keyboard thinks the level is at max...but mainstage thinks the level is at 1pm.
    i am using Logic 9, and i have a macbook pro 2.9 Ghz I7 with 8 gigs of memory and OS X 10.8.4

    Hi Josh,
    Thanks for taking the time to contact us here a Novation for technical support. Lets continue to correspond via email so we can get your issue resolved.
    Thanks.
    Mike Towns

  • How do I get the numbers ipad app to plot a graph of dates against values, where the most recent date is on the right of the graph, but the most recent date is at the top rather than bottom of the rows in the table?

    How do I get the numbers ipad app to plot a graph of dates against values, where the most recent date is on the right of the graph, but the most recent date is at the top rather than bottom of the rows in the table?
    Also how can it be a line graph without plotting a circle at each value?
    Thanks this is very frustrating

    Make a copy of the table and produce your Line chart or Bar chart from the copy. Sort the copy into the order you want to see in your chart.
    Alternately you could use a Scatter Chart...
    Jerry

Maybe you are looking for

  • How to override strings in ww_strings.xlf

    Hi, I am facing an issue with overriding ww_strings.xlf which is available at <Middleware_Home> / Oracle_ECM1/ucm/idc/components/Localization/lang / <language code >. In general we can create a resource for strings in a custom component and we overri

  • System copy of a ABAP+J2EE WAS 6.40 system - issue w. J2EE instance/Mapbox

    Hi guys and girs! I'm doing a system copy of a CRM 4 system based on Web AS 6.40 and with a dual stack system. The J2EE instance is only used for Mapbox and nothing else. I've done a system export of the J2EE instance on the source system, but when I

  • User specific popup problem

    Hello experts ,               I have used the Function module 'TH-popup' to give an user specific popup . But I can show a message less than 128 char by this Function module. Is there any other way by which I can print user specific popup longer than

  • Clean Leopard install on a new MacBook Pro???

    Hi all, I have a brand new MBP, with Leopard on disk as provided in the box. I think it's an upgrade version, if there is such a thing. I have heard that it's a good idea to do a 'clean" OS install, to get rid of trialware and stuff, also to help sys

  • HT2905 Duplicate Songs

    I can't find a way to display duplicate songs in the new version of Itunes.  Any ideas on how to delete duplicates easier than going through 1 by 1?