Period and Date Calc Functions

This article will detail how to create custom functions to allow you to bring in exactly the data you need. 

When designing a Report, the user may need a certain type of Period that is not found in the Period Functions menu. Solver Report Designer (RD) comes with default period calculations (PeriodCalcs) that are available in the Period Function menu found in the RD Navigation pane.

NOTE: As of 2/3/2022, the Date function is not supported by Publisher. Please Use PeriodCalc if your report interacts with Publisher.

This menu may appear as an Icon at the bottom of this menu for users who have access to many modules.

Applying a Period Function

The user can easily apply a Period Function by following these steps:

  1. Click on the expanding column or row in the Layout Editor. In many cases, Period is a parameter defined on the Filters tab.
  2. Click on Period Functions in the RD Navigation pane. 
  3. Drag the desired function into the Filters tab.
  4. This will replace the Period filter with the Period Function based on the parameter.
  5. In this case, we have dragged in the Function “All Year 2 Years Ago” which will return the entire year, 2 years ago based on the Period parameter provided. 

Applying A PeriodCalc Function

Applying a Period Calc function is slightly different than the out-of-the-box Period Functions. 

  1. In the Layout Editor, make sure Period is a filter.
  2. From the table below, copy the Expression that relates to the Period Function needed and paste it into the Period filter.

The equivalent of the above formula, but using a PeriodCalc would look like this.

The tables below detail many available PeriodCalc functions that can be used and combined to achieve the results needed. They are broken into these four sections:

  1. Operators: use these with any “built-in function” to achieve the custom period/date range needed
  2. Date Operators: these can be used with any Date function
  3. Built-in functions: a listing of available PeriodCalc examples
  4. Date functions: a listing of available DateCalc examples

Table: Operators

Below are operators that can be used with PeriodCalcs.

Note: Each ERP may have a different syntax for the word “Period” below. Be sure to replace “Period” based on the Period syntax of your ERP.

Example: Data Warehouse Reporting uses “Period”, but GP Reporting uses “PostingPeriod”. Therefore, when Reporting off GP, in the below examples, replace “Period” with “PostingPeriod”.

ExpressionExampleComments
Add(){PeriodCalc.GetPeriod(Period).Add(-1)}Adds designated number of periods. The value can be positive or negative.
AddYears(){PeriodCalc.GetPeriod(Period).AddYears(-1)}Adds designated number of years. The value can be positive or negative.
WholeYear{PeriodCalc.GetPeriod(Period).WholeYear}Calculates the entire year range that the Period belongs in.
YearStart{PeriodCalc.GetPeriod(Period).YearStart}Calculates the first period of the year.
YearEnd{PeriodCalc.GetPeriod(Period).YearEnd}Calculates the last period of the year.
WholeQuarter{PeriodCalc.GetPeriod(Period).WholeQuarter}Calculates the entire quarter range that the Period belongs in.
QuarterStart{PeriodCalc.GetPeriod(Period).QuarterStart}Calculates the first period of the Quarter.
QuarterEnd{PeriodCalc.GetPeriod(Period).QuarterEnd}Calculates the last period of the Quarter.
SetIndex(){PeriodCalc.GetPeriod(Period).SetIndex(4)}Calculates to the designated period number (i.e. 201204). The value must be between 1 and 12.
Extend(){PeriodCalc.GetPeriod(Period).Extend(2)}Calculates the range beginning with the period plus the number inside the Extend operation (i.e. 201201:201203). The value can be positive or negative.

Table: Date Operators

Below is a list of date operators that can be used with any Date function.

Note: single quotes as shown below are required for Date functions.

ExpressionExampleComments
AddDays()‘{Date.AddDays(-7).SqlDate}’Adds designated number of days. The value can be positive or negative.
AddMonths()‘{Date.AddMonths(1).SqlDate}’Adds designated number of months. The value can be positive or negative.
AddYears()‘{Date.AddYears(1).SqlDate}’Adds designated number of years. The value can be positive or negative.
Now‘{PeriodCalc.Now.SqlDate}’Calculates the current date.
StartDate‘{PeriodCalc.GetPeriod(Date).StartDate.SqlDate}’Calculates the exact start date of the period that the Date parameter belongs in.
EndDate‘{PeriodCalc.GetPeriod(Date).EndDate.SqlDate}’Calculates the exact end date of the period that the Date parameter belongs in.
WeekStart‘{PeriodCalc.Now.WeekStart.SqlDate}’Calculates the date of the beginning of the current week (Sunday).

Table: Built-in Period Functions

NameDescriptionExpression
 CurrentPeriod()Calculates the Current Period{PeriodCalc.CurrentPeriod}
ALL2YagoAll Year 2 Years Ago{PeriodCalc.GetPeriod(Period).AddYears(-2).WholeYear}
ALL2YforAll Year 2 Years Forward{PeriodCalc.GetPeriod(Period).AddYears(2).WholeYear}
All3YAgoAll Year 3 Years Ago{PeriodCalc.GetPeriod(Period).AddYears(-3).WholeYear}
All3YForAll Year 3 Years Forward{PeriodCalc.GetPeriod(Period).AddYears(3).WholeYear}
AllTimeTDAll Time to Date{PeriodCalc.GetPeriod(0)}:{PeriodCalc.GetPeriod(Period)}
FPLYFirst Period Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).YearStart}
FPNYFirst Period Next Year{PeriodCalc.GetPeriod(Period).AddYears(1).YearStart}
FPTYFirst Period This Year{PeriodCalc.GetPeriod(Period).YearStart}
LPLYLast Period Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).YearEnd}
LPNYLast Period Next Year{PeriodCalc.GetPeriod(Period).AddYears(1).YearEnd}
LPTYLast Period This Year{PeriodCalc.GetPeriod(Period).YearEnd}
LYLast Year (all){PeriodCalc.GetPeriod(Period).AddYears(-1).WholeYear}
LYTDLast year to date{PeriodCalc.LastYearToDate(Period)}
NYNext Year (all){PeriodCalc.GetPeriod(Period).AddYears(1).WholeYear}
Q1LYQ1 Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).YearStart.Extend(2)}
Q1TYQ1 This Year{PeriodCalc.GetPeriod(Period).YearStart.Extend(2)}
Q2LYQ2 Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).SetIndex(4).Extend(2)}
Q2TYQ2 This Year{PeriodCalc.GetPeriod(Period).SetIndex(4).Extend(2)}
Q3LYQ3 Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).SetIndex(7).Extend(2)}
Q3TYQ3 This Year{PeriodCalc.GetPeriod(Period).SetIndex(7).Extend(2)}
Q4LYQ4 Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).SetIndex(10)}:{PeriodCalc.GetPeriod(Period).AddYears(-1).YearEnd}
Q4TYQ4 This Year{PeriodCalc.GetPeriod(Period).SetIndex(10)}:{PeriodCalc.GetPeriod(Period).YearEnd}
RB12M12 Month Rolling (-1 -> -12){PeriodCalc.GetPeriod(Period).Add(-1).Extend(-11)}
RBC12M12Month Rolling Current (0 > -12){PeriodCalc.GetPeriod(Period).Add(0).Extend(-11)}
RF12M12 Months Rolling (+1 -> +12){PeriodCalc.GetPeriod(Period).Add(1).Extend(11)}
RF36M36 Months Rolling (+1 -> +36){PeriodCalc.GetPeriod(Period).Add(1).Extend(35)}
RF3M13 Months Rolling (+1 -> +3){PeriodCalc.GetPeriod(Period).Add(1).Extend(2)}
RF3M23 Months Rolling (+4 -> +6){PeriodCalc.GetPeriod(Period).Add(4).Extend(2)}
RF3M33 Months Rolling (+7 -> +9){PeriodCalc.GetPeriod(Period).Add(7).Extend(2)}
RF3M43 Months Rolling (+10 -> +12){PeriodCalc.GetPeriod(Period).Add(10).Extend(2)}
RFC12M12 Months Rolling Current (0 > 12){PeriodCalc.GetPeriod(Period).Add(0).Extend(11)}
RPLYRemaining Periods Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1).Add(1)}: {PeriodCalc.GetPeriod(Period).AddYears(-1).YearEnd}
RPTYRemaining Periods This Year{PeriodCalc.GetPeriod(Period).Add(1)}:{PeriodCalc.GetPeriod([]).YearEnd}
TPLYThis Period Last Year{PeriodCalc.GetPeriod(Period).AddYears(-1)}
TPNYThis Period Next Year{PeriodCalc.GetPeriod(Period).AddYears(1)}
TPTYThis Period This Year{PeriodCalc.GetPeriod(Period)}
TYALLThis Year (all){PeriodCalc.GetPeriod(Period).WholeYear}
YTDYear to Date{PeriodCalc.FiscYearToDate(Period)}
 Quarter to Period{PeriodCalc.QuarterStart(Period)}:{@Period}
 Next Quarter{PeriodCalc.QuarterStart(Period).Add(3)}:{PeriodCalc.QuarterEnd(Period).Add(3)}
 Last Quarter{PeriodCalc.QuarterStart(Period).Add(-3)}:{PeriodCalc.QuarterEnd(Period).Add(-3)}
 All Time to Period{PeriodCalc.GetPeriod(0)}:{PeriodCalc.GetPeriod(Period)}
 Prior Year Qtr to Period{PeriodCalc.GetPeriod(Period).AddYears(-1).QuarterStart}:{PeriodCalc.GetPeriod(Period).AddYears(-1)}
 YTD 2 Years Ago{PeriodCalc.GetPeriod(Period).AddYears(-2)YearStart}:{PeriodCalc.GetPeriod(Period).AddYears(-2)}

Table: Date Functions

Below is a list of functions that require the use of a parameter that is a “Date Lookup”. 

Note: Date Functions require single quotes as shown below.

NameDescriptionExpression
 Today‘{PeriodCalc.Now.SqlDate}’
 Yesterday‘{PeriodCalc.Now.AddDays(-1).SqlDate}’
 Month to Date‘{PeriodCalc.GetPeriod(Date).StartDate.SqlDate}’:{@Date}
 Quarter to Date‘{PeriodCalc.GetPeriod(Date).QuarterStart.StartDate.SqlDate}’:{@Date}
 Year to Date‘{PeriodCalc.GetPeriod(Date).YearStart.StartDate.SqlDate}’:{@Date}
 Year Start Date‘{PeriodCalc.GetPeriod(Date).YearStart.StartDate.SqlDate}’
 Year End Date‘{PeriodCalc.GetPeriod(Date).YearEnd.EndDate.SqlDate}’
 Period start Date‘{PeriodCalc.GetPeriod(Date).StartDate.SqlDate}’
 Month End Date‘{PeriodCalc.Now.MonthEnd.SqlDate}’
 Quarter Start Date‘{PeriodCalc.GetPeriod(Date).QuarterStart.StartDate.SqlDate}’
 Quarter End Dates‘{PeriodCalc.GetPeriod(Date).QuarterEnd.EndDate.SqlDate}’
 Last Year Current Quarter‘{PeriodCalc.GetPeriod(Date)QuarterStart.Add(-12)}:{PeriodCalc.GetPeriod(Date)QuarterEnd.Add(-12)}’
 Last Year Quarter to Date‘{PeriodCalc.GetPeriod(Date).QuarterStart.StartDate.SqlDate}’:'{Date}’
 Last Month to Date‘{PeriodCalc.Now.MonthStart.AddMonths(-1).SqlDate}’:'{PeriodCalc.Now.AddMonths(-1).AddDays(-1).SqlDate}’
 Prior Year entire month‘{PeriodCalc.Now.MonthStart.AddYears(-1).AddMonths(0).AddDays(0).SqlDate}’:'{PeriodCalc.Now.AddYears(-1).AddMonths(0).AddDays(-1).SqlDate}’ 
Updated on July 19, 2023
Was this article helpful?

Related Articles