UC9 - Calculate Relative Date Values

You often need to filter values and make today's date relative.

See Also
FILTER
Expression Operators
Expression Language

In this first example, you want to add a FILTER operator in the data query, and enter an expression to show the values for the last 3 days, 3 weeks, or 3 months.

  • To calculate the values of the last 3 days, enter:

    input >= Date.today().subtract(amount: Period.of(days:3))

  • To calculate the values of the last 3 weeks, enter:

    input >= Date.today().subtract(amount: Period.of(weeks:3))

  • To calculate the values of the last 3 months, enter:

    input >= Date.today().subtract(amount: Period.of(months:3))

In this second example, you want to enter an expression to make today's date relative to the current week or month.

  • To calculate the values for the current week, enter:

    today:Date=Date.today();
      input.weekOfYear== today.weekOfYear AND input.year==today.year

  • To calculate the values for the current month, enter:

    today:Date=Date.today();
      input.month== today.month AND input.year==today.year