function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
d.macwhinnie1.3962891050876328E12d.macwhinnie1.3962891050876328E12 

Formula / Rollup Summary Question

I'm trying to write a Roll-up Summary to Count the Value of Records that were created This Week and Last Week.  However, since Roll-up Summary fields do not support Dynamic Date parameters I need to somehow create a Formula Field that returns a "Yes" or "No" value if the record was created Last Week or This Week.

Does anyone have a clever way of creating a Formula Field on an Object that would return the value of Yes or No based on the following:

1 Field
IF(CreatedDate = "This Week", "This", IF(CreatedDate = "Last Week", "Last", "Neither))

Then I can write a Roll-up Summary to Sum Records where Field = This and a second Rollup Summary where Field = Last.

or

2 Fields
Field 1: IF(CreatedDAte = "This Week", "Yes", "No")

Field2: IF(CreatedDAte = "Last Week", "Yes", "No")

Then I can write a Roll-up Summary to Sum Records where Field1 = Yes and a second Rollup Summary where Field2 = Yes.


Thank you.
Boom B OpFocusBoom B OpFocus
It is possible to create a formula field to check for This Week or Last Week.  Here is a link to some advanced examples from salesforce https://help.salesforce.com/apex/HTViewHelpDoc?id=formula_examples_dates.htm&language=en_US#week-of-year.  

But I don't think you can use that formula in your roll-up summary field, according to Salesforce:
"Roll-up summary fields can calculate the values of formula fields if they do not contain cross-object field references or functions that automatically derive values on the fly, such as NOW or TODAY."