The Assette Get Valid Periods (ast_fn_GetValidPeriods) Data Block is an Open Source Data Block and may be copied or edited.
The Assette Get Valid Periods (ast_fn_GetValidPeriods) Data Block processes a list of periods (e.g., MTD
, QTD
, YTD
, etc.) based on parameters such as the reference date (AsofDate
), fiscal year-end, and inception date. It retrieves the begin_date
and end_date
for each period and allows for optional filtering of non-applicable and duplicate periods. The Assette Get Valid Periods (ast_fn_GetValidPeriods) Data Block then organizes and returns the calculated date ranges in a structured format. This Data Block is open-source and may be edited as desired.
Input Parameters: #
- AsofDate: The reference date for calculating periods.
- PeriodList: A comma-separated list of period codes (e.g.,
MTD
,QTD
,YTD
, etc.) to calculate. - SuppressNotApplicablePeriods: If
"yes"
, excludes periods that begin before theInceptionDate
. - SuppressDuplicatePeriods: If
"yes"
, removes duplicate periods based onbegin_date
andend_date
, prioritizing certain period codes. - FiscalYearEnd: The fiscal year-end date, used for fiscal period calculations.
- InceptionDate: The date from which the relevant periods start.
- DatePattern: The format of dates in the input and output (e.g.,
"%Y-%m-%dT%H:%M:%S"
).
The Assette Get Valid Periods (ast_fn_GetValidPeriods) Data Block reads the begin_date
and end_date
for each period by calling ast_fn_GetBeginEndDates
, passing the period code, AsofDate
, InceptionDate
, and FiscalYearEnd
.
- The retrieved dates are added to a Pandas DataFrame (
period_frame
) with columnsperiod
,begin_date
, andend_date
. - Suppress Not Applicable Periods: If
SuppressNotApplicablePeriods
is"yes"
, the Data Block filters out periods where thebegin_date
is before theInceptionDate
. - Suppress Duplicate Periods:
- If
SuppressDuplicatePeriods
is"yes"
, a ranking system is applied to prioritize certain periods (e.g.,MTD
,QTD
,YTD
,12MT
). - Duplicate periods (same
begin_date
andend_date
) are removed based on the ranking. For example,MTD
might take precedence overQTD
if they share the same date range.
- If
General Info #
The following table shows the default fields of the Data Block.
Field | Value |
---|---|
Name | ast_fn_GetValidPeriods |
Block Category | Transform |
Block Type | Python |
Data Category | None |
Output Type | Data Table |
Editable | True |
Dependencies #
The following table shows the default dependencies of the Data Block.
Data Block | Description |
---|---|
[Link] | |
[Link] | |
[Link] | |
[Link] | |
[Link] |
Columns #
The following columns are the default columns for the Data Object, all columns are optional unless marked otherwise. Please see footnotes for additional information.
Name | Data Type | Example | Description |
---|---|---|---|
Example Definition #
Example Request #
The following code shows an example request using the default values of the Data Block.
{
"AsofDate": "2023-04-30",
"InceptionDate": "2017-12-07",
"FiscalYearEnd": "04-30",
"SuppressNotApplicablePeriods": "yes",
"SuppressDuplicatePeriods": "yes",
"PeriodList": "MTD,QTD,YTD,12MT,3YA,5YA,5YC,7YA,10YA,ITDA",
"DatePattern": "%Y-%m-%d"
}
Example Response #
The following code shows an example response using the default values of the Data Block. The default data source is the Assette Snowflake Demo Instance. The response may be shortened for brevity.
{
"data": [
{
"period": "MTD",
"begin_date": "2023-03-31 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "YTD",
"begin_date": "2022-12-31 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "12MT",
"begin_date": "2022-04-30 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "3YA",
"begin_date": "2020-04-30 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "5YA",
"begin_date": "2018-04-30 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "5YC",
"begin_date": "2018-04-30 00:00:00",
"end_date": "2023-04-30 00:00:00"
},
{
"period": "ITDA",
"begin_date": "2017-12-07 00:00:00",
"end_date": "2023-04-30 00:00:00"
}
],
"errors": [],
"success": true,
"logs": []
}