date()

Returns a date that can be used in a filter. This function takes a year, a month, and a day dimension as input.

Syntax 

date(year, month, day)

Usage 

Specify the year, month, and day. Each input value must be a date dimension type.

1date('OrderDate_Year', 'OrderDate_Month', 'OrderDate_Day')

Example 

Which opportunities have your reps closed in the past 30 days? Use date() to select records with a close date in the past 30 days.

1q = load "DTC_Opportunity";
2
3-- use date() to create a date that you can use in a filter
4-- 'CloseDate_Year', 'CloseDate_Month', and 'CloseDate_Day' are date fields in the DTC_Opportunity data set
5
6q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["30 days ago".."current day"];
7q = group q by 'Account_Owner';
8q = foreach q generate 'Account_Owner' as 'Account_Owner', sum('Amount') as 'sum_Amount';
9q = order q by 'Account_Owner' asc;

See Also