5

I have a Date field which contains, across several child records:

(2014-07-1,2014-07-5,2014-07-8,2014-07-9,2014-08-1,2014-08-5,2014-08-8........), now in these values I want to get the current month(August) minimum date value, that is: 2014-08-1.

How to do this in Formula field?

4
  • how are these date values stored ? comma separated in a text field ? or these are values from a single date field across multiple records ? Aug 13, 2014 at 12:14
  • @VamsiKrishna No these are not comma separated values,these are single date field values. Aug 13, 2014 at 12:16
  • You want to save in the parent the minimum month from a related list of childObject.dateField__c ? If yes, please reword your question
    – cropredy
    Aug 13, 2014 at 16:29
  • @crop1645 Yes i want exactly. Aug 13, 2014 at 16:46

4 Answers 4

1

I don't think there's a formula that could reliably do this, but it could certainly be done with an Apex trigger.

Although it seems like it would be worth separating these date entries into a related custom object & then simply using a Rollup (min) field to find the lowest value in the current month.

1
0

Realized I misread the question, I think you would need a trigger to do this, since I don't believe rollup filters let you use relative dates: see idea exchange idea here https://success.salesforce.com/ideaView?id=08730000000BrUAAA0

0

you can do it just using formula.
in your child obj, create a number type formula to calc the result, the main part is use your date field minus first date of the month :
DATEVALUE(Your-Date-Field) - DATE( YEAR(DATEVALUE( $System.OriginDateTime )) , MONTH(DATEVALUE( $System.OriginDateTime )) ,1)
and use if else to get result only when the result greater than 0.

then in the parent object, create a rollup summary for store the minus value,
then create an formula to calc the min date, use first date of the month plus the minus value.

0

you can use this :

date.today().toStartOfMonth()

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .