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: { |
| afterOrEqualTo | Date is after or equal to comparator date. Required Criteria: { |
| 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: { |
| beforeOrEqualTo | Date is before or equal to comparator date. Required Criteria: { |
| between | Between Required Criteria: { |
| equals | Equals comparator criterion. Required Criteria: { |
| 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 |
|
| yearToDate | Date is in the same year to date. |
| yesterday | Date is yesterday. |