+ Reply to Thread
Results 1 to 5 of 5

Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

  1. #1
    Registered User
    Join Date
    11-11-2020
    Location
    Washington State
    MS-Off Ver
    MS 2016
    Posts
    3

    Smile Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

    Hello,

    I have a table with two columns. One column contains employee IDs. The other column contains dates in descending order.

    My goal is to find a formula for a third column in my table that references the employee ID for each row to look up and return the next date value (if any) in a row below that matches on the employee ID.

    I am open to a solution that needs the dates in column two to be number or date format. The output column can also return number or date format. Whatever works for your awesome solution!

    Thank you

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

    Copy your first query. Now join the two queries on the ID. Expand the new column and select only the dates. Group the new query on the ID and select the Max Date

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    11-11-2020
    Location
    Washington State
    MS-Off Ver
    MS 2016
    Posts
    3

    Re: Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

    Thank you for this suggestion!I really appreciate it.

    Unfortunately, the workbook with the new Power Query doesn't solve my problem. I need to see each day-over-day relationship, and there are numerous Employee IDs in my real data with 3,4,5+ day-over-day relationships even within the same fiscal week.*

    Your query gives me:
    14 8/29/2022

    I need:
    14 8/27/2022 8/28/2022
    14 8/28/2022 8/29/2022

    --

    FYI, I only had luck finding DAX solutions in the Power BI community or really complex custom column formulas.

    *I have a PQ solution but I have to limited the data to just Employee IDs with 2 create dates within the same fiscal week.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

    This solution only works outside the table.
    Please Copy the values of the table and try in cell G4 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-11-2020
    Location
    Washington State
    MS-Off Ver
    MS 2016
    Posts
    3

    Thumbs up Re: Two Column List - Descending Dates and IDs- Find Next Date in List Matching Row ID

    Thank you--that works So, you're excluding the current row in the Match range! Smart.

    Then I use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to find a relationship between the two dates.

    If anyone is curious, I did also find a Power Query workaround based on using two index columns.* I am seeing some chatter about Index being finicky sometimes in Power Query though + the first row of data gets sacrificed and I couldn't find a workaround yet..

    Excited to have multiple possible solutions.Thanks Excel people!

    *I'm not allowed to post a link but you can find the Stack Overflow article using this path: questions/54827273/power-query-subtract-row-below-from-row-above-using-multiple-conditions

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find if a date has a match in a list of dates
    By Irdanwen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2019, 04:56 AM
  2. Replies: 6
    Last Post: 12-30-2015, 07:39 AM
  3. Find if a date is between 2 list of dates
    By radicaled in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2013, 04:08 PM
  4. Macro to show date range from 'custom' column (Quarter 1) from list of dates
    By danlRB80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2013, 09:16 AM
  5. [SOLVED] Look for values in a list, count and list in descending order
    By sans in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 05-15-2012, 09:16 AM
  6. Replies: 14
    Last Post: 04-17-2012, 05:18 PM
  7. Using Match and DateSerial to find matching date in list
    By Cutter in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-16-2010, 11:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1