Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Comparing Dates Grouping By Another Column

Example data is below. 

DateItem
1/5/2024XX
1/20/2024XX
1/20/2024XX
1/15/2024XY
1/20/2024XY
1/25/2024XY

 

I am trying to group by Item and compare the original date (earliest date) with the modified date to see how much delay was caused.

 

How can I group by Item and compare the dates? Thanks

 

Ideally, a third column would have something like this (in days):

Difference
blank()
15 
0
blank()
5
5
  • Anonymous,

     

    Here's a Power Query solution:

     

    1. Group by Item and add columns Min Date and All (all rows):

     

     

    2. Click the double arrow on the All column and select Date:

     

     

    3. Add a custom column Delay:

     

    Duration.Days([Date] - [Min Date])

     

    4. Result:

     

     

1 Reply

  • Anonymous,

     

    Here's a Power Query solution:

     

    1. Group by Item and add columns Min Date and All (all rows):

     

     

    2. Click the double arrow on the All column and select Date:

     

     

    3. Add a custom column Delay:

     

    Duration.Days([Date] - [Min Date])

     

    4. Result: