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
Vadivel MuruganVadivel Murugan 

LAST_N_90 Days Record

Hi,

I want to Show the tabular format for Created Opportunity in Last 90 days recode. I would like to shown in below:

1 - Month Record for one table
2 - Month Record for another table
3 - Month record for another table

1 - Month for Weekly table Opportunity
2 - Month for Weekly table Opportunity
3 - Month for Weekly table Opportunity

Finally i have shown all 3 month record in single table. If any know about this idea, Please share with me.
salesforce mesalesforce me
hi

1)Select * from case where WHERE CreatedDate = LAST_N_DAYS:30

2)SOQL TO QUERY RECORDS CREATED IN THE LAST 30 (N) DAYS : DATE CONSTRAINT1:27 PMLAST_N_DAYS:20

This clause means LAST 20 Days.

Using this in a SOQL Query to fetch the List of Cases created 30 days ago, the query will be 
List<Cases> allCases = [Select Id from Cases where CreatedDate >= LAST_N_DAYS:30];
THIS_WEEK

This clause fetches records created this week. The Week is calculated as per the notes from Salesforce as :Starts 12:00:00 on the most recent first day of the week before the current day and continues for seven full days. First day of the week is determined by your locale.

List<Cases> allCases = [Select Id from Cases where CreatedDate < THIS_WEEK];
More Links and methods:

Apex Date Filters:http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm 

List View Filters: https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_dates.htm&language=en 


3)
Date d = System.today() - 7; List<Opportunity> opportunities = [SELECT OwnerId, Amount, Probability FROM OPPORTUNITY where Amount > 0 and LastModifiedDate < :d];