Author Topic: Extract Minimum and Maximum Dates by Group  (Read 163 times)

Offline rajua99

  • Full Member
  • ***
  • Join Date: Jun 2009
  • Posts: 41
  • Forum Citizenship: +0/-0
Extract Minimum and Maximum Dates by Group
« on: 14 Jun 2021 04:56:36 pm »
Hello,

In my report i applied Group by on Segment, Job and Sub Job Number.

I want to extract max and min date for each Segment/job/sub by their group.

For example in the below sample data I want to get the min date as May 3rd and Max Date as May 21st for Sub 01 and May 13th -June 4th for Sub 09

Can you please help us with a formula to extract max and min dates.


Job No      Sub   SegmentDesc   Week   Min                   Max                  Duration   Date Worked   Start Date           End Date
                           
ACMV00   01    Supervision   Monday   May 3, 2021   May 21, 2021    18.00    May 3, 2021   May 3, 2021   May 3, 2021
ACMV00   01    Supervision   Friday                                                    May 21, 2021   May 21, 2021   May 21, 2021

ACMV00   09    Supervision   Thursday   May 13, 2021   Jun 4, 2021    22.00    May 13, 2021   May 13, 2021   May 13, 2021
ACMV00   09    Supervision   Friday                                                    Jun 4, 2021   Jun 4, 2021   Jun 4, 2021

Thanks in advance
Raju


Offline MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 11,329
  • Forum Citizenship: +665/-10
  • Cognos Software Muppet
Re: Extract Minimum and Maximum Dates by Group
« Reply #1 on: 15 Jun 2021 08:07:39 am »
Hello,

In my report i applied Group by on Segment, Job and Sub Job Number.

I want to extract max and min date for each Segment/job/sub by their group.

For example in the below sample data I want to get the min date as May 3rd and Max Date as May 21st for Sub 01 and May 13th -June 4th for Sub 09

Can you please help us with a formula to extract max and min dates.


Job No      Sub   SegmentDesc   Week   Min                   Max                  Duration   Date Worked   Start Date           End Date
                           
ACMV00   01    Supervision   Monday   May 3, 2021   May 21, 2021    18.00    May 3, 2021   May 3, 2021   May 3, 2021
ACMV00   01    Supervision   Friday                                                    May 21, 2021   May 21, 2021   May 21, 2021

ACMV00   09    Supervision   Thursday   May 13, 2021   Jun 4, 2021    22.00    May 13, 2021   May 13, 2021   May 13, 2021
ACMV00   09    Supervision   Friday                                                    Jun 4, 2021   Jun 4, 2021   Jun 4, 2021

Thanks in advance
Raju

Hi,

Which item specifically do you need to find the max and min values for? You appear to have three date items - will they always be the same?

Assuming it's Date Worked, and also assuming you need to take account of both the Job No and the Sub items for the maximum, you can write expressions in query calculations. Max value would be

maximum([Date Worked] for [Job No],)

Min value would be the same but using minimum() instead of maximum()

Cheers!

MF.

Meep!