[SalesForce] How to calculate Current quarter and last month of previous quarter in List View

I need a list view to display List of records of current quarter and last month of previous quarter. I think I need to write a formula field to calculate current quarter and last month of previous quarter records.

Can anyone suggest me with formula how to write for above condition or any other way to achieve the above scenario?

Best Answer

If January starts a quarter the following checkbox formula should be works :

OR(
    /* When the year is similar between the date field and current year */
    AND(
        YEAR(  DateField__c ) = YEAR( TODAY() ),
        OR(
            /* Check if is the date field is on the same quarter of today */
            CEILING( MONTH( DateField__c) / 3 ) = CEILING( MONTH( TODAY() ) / 3 ),
            /* Or if the date field + one month is on the same quarter of today */
            AND (CEILING( MONTH( ADDMONTHS(DateField__c,1) ) / 3 ) = CEILING( MONTH( TODAY() ) / 3 ), MONTH( DateField__c ) < 12)
        )
    ),
    /* And we manage the case of the december of previous year */
    AND(
        YEAR( DateField__c ) = YEAR( TODAY() )-1,
        MONTH( DateField__c) = 12,
        CEILING( MONTH( TODAY() ) / 3 ) = 1 
    )
)

In your list view add this checkbox formula in your filter with "true" value.