Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Using Max with Dates

I have the following table:

GenericDrugEntryDateTable4.JPG

I need to have a calculated dimension "Generic Product Entry Date" calculated as a maximum of a range of dates as follows:

=If([GPatent Expiry Date] > ExclusivityDate, Max([GPatent Expiry Date]), Max(ExclusivityDate))


I get errors as in the above table.  How do i accomplish this with set analysis or whatever is appropriate?


Regards.


1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

‌mMay be use aggr(max()) like

=Aggr(Max(if(Date1> Date2, Date1,Date2)), Date1)

change the fieldnames with your your original names.

View solution in original post

5 Replies
Lisa_P
Employee
Employee

Why is this not an expression ?

vishsaggi
Champion III
Champion III

‌mMay be use aggr(max()) like

=Aggr(Max(if(Date1> Date2, Date1,Date2)), Date1)

change the fieldnames with your your original names.

Anonymous
Not applicable
Author

Thank you very much.  I changed the field names to the following:

=Aggr(Max(if([GPatent Expiry Date]> ExclusivityDate, [GPatent Expiry Date],ExclusivityDate)), [GPatent Expiry Date])


and I get the following results:


GenericDrugEntryDateTable5.JPG

For the product circled in red ACALABRUTINIB, it has more than 1 Generic Drug Product Entry Dates, however, this should be a single date which is the maximum of the Patent Expiry Date and Should be 01/07/2036 since the Maximum Exclusivity date is less than the Maximum Patent Expiry Date.


Regards.


Chris

Anonymous
Not applicable
Author

Many thanks for your reply.  However i do not understand your question in the reply.

Regards

Chris

Anonymous
Not applicable
Author

The correct Expression is as follows, Date1 at the end of the expression should be Date2


=Aggr(Max(if([GPatent Expiry Date]> ExclusivityDate, [GPatent Expiry Date],ExclusivityDate)), ExclusivityDate)


Regards.


Chris