4 Replies Latest reply on Oct 3, 2018 4:11 AM by Manish Chauhan

# Sum of Date Difference based on the unique value in another column

Sum of Date Difference based on the unique value in another column

I have column in data "PO_Number" which is repeating.

I have date_from and Date_to columns in data.

I want to calculate the days between date_from and date_to but only consider the one po line one time.

example:

PO_number          Date_From          Date_to               Diff

100                         01/01/2010          05/01/2010          5

100                         01/01/2010          05/01/2010          5

200                         01/01/2010          10/01/2010          10

200                         01/01/2010          10/01/2010          10

Expected result:

PO_Number          Diff

100                         5

200                         10

Sum(diff) = 15

Regards,

Usman

• ###### 1. Re: Sum of Date Difference based on the unique value in another column

Hi Usman,

It will work

Thanks,

Ritesh

• ###### 3. Re: Sum of Date Difference based on the unique value in another column

This is used to avoid sum , you can even use max

max or min of 10 & 10 will be 10 only

Otherwise it will sum every time 10+10=20 because of duplicate values

Thanks,

Ritesh

• ###### 4. Re: Sum of Date Difference based on the unique value in another column

Hi Usman,

Please find the attached workbook for the solution.

Please do mark it as correct ans if it solves your problem.

Thank you,

Manish Chauhan