ExcelScript.DateFilterCondition enum

Enum representing all accepted conditions by which a date filter can be applied. Used to configure the type of PivotFilter that is applied to the field.

Remarks

Examples

/**
 * This script applies a filter to a PivotTable that filters out rows 
 * that aren't from this month.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the "Date Recorded" field to filter. 
  // The data in this field must be dates in order for the filter to work.
  const pivot = workbook.getPivotTables()[0];
  const rowHierarchy = pivot.getRowHierarchy("Date Recorded");
  const rowField = rowHierarchy.getFields()[0];

  // Apply the date filter.
  rowField.applyFilter({
    dateFilter: {
      // Setting the condition to `thisMonth` means items that are before or
      // after this month will not be displayed.
      condition: ExcelScript.DateFilterCondition.thisMonth
    }
  });
}

Fields

after

Date is after comparator date.

Required Criteria: {comparator}. Optional Criteria: {wholeDays}.

afterOrEqualTo

Date is after or equal to comparator date.

Required Criteria: {comparator}. Optional Criteria: {wholeDays}.

allDatesInPeriodApril

Date is in April.

allDatesInPeriodAugust

Date is in August.

allDatesInPeriodDecember

Date is in December.

allDatesInPeriodFebruary

Date is in February.

allDatesInPeriodJanuary

Date is in January.

allDatesInPeriodJuly

Date is in July.

allDatesInPeriodJune

Date is in June.

allDatesInPeriodMarch

Date is in March.

allDatesInPeriodMay

Date is in May.

allDatesInPeriodNovember

Date is in November.

allDatesInPeriodOctober

Date is in October.

allDatesInPeriodQuarter1

Date is in Quarter 1.

allDatesInPeriodQuarter2

Date is in Quarter 2.

allDatesInPeriodQuarter3

Date is in Quarter 3.

allDatesInPeriodQuarter4

Date is in Quarter 4.

allDatesInPeriodSeptember

Date is in September.

before

Date is before comparator date.

Required Criteria: {comparator}. Optional Criteria: {wholeDays}.

beforeOrEqualTo

Date is before or equal to comparator date.

Required Criteria: {comparator}. Optional Criteria: {wholeDays}.

between

Between lowerBound and upperBound dates.

Required Criteria: {lowerBound, upperBound}. Optional Criteria: {wholeDays, exclusive}.

equals

Equals comparator criterion.

Required Criteria: {comparator}. Optional Criteria: {wholeDays, exclusive}.

lastMonth

Date is last month.

lastQuarter

Date is last quarter.

lastWeek

Date is last week.

lastYear

Date is last year.

nextMonth

Date is next month.

nextQuarter

Date is next quarter.

nextWeek

Date is next week.

nextYear

Date is next year.

thisMonth

Date is this month.

thisQuarter

Date is this quarter.

thisWeek

Date is this week.

thisYear

Date is this year.

today

Date is today.

tomorrow

Date is tomorrow.

unknown

DateFilterCondition is unknown or unsupported.

yearToDate

Date is in the same year to date.

yesterday

Date is yesterday.