Can be paired with Qlik Subroutine - Fiscal Year Fiscal Period Loop to setup arguments for table creation
SUB RecentFP
// Starting Fiscal Period
LET vFP_Start = DATE(DATE#('202401','YYYYMM'));
// Today but converted to be the first of the month
// Fiscal Periods do NOT care about days, by converting to month start we are treating every date as the 1st of the month
LET vToday = MonthsStart(1, DATE(TODAY()));
// Fiscal Period for 'now' is company dependent, this example is 3 months ahead
// e.g. 2025-01-07 is the current date, that means current FP is 202504
LET vFP_Today = AddMonths(vToday,3);
// If the business wishes to end the Fiscal Period investigation early, that can be modified
// e.g. This example is 1 month back, so end FP is 202503 here
LET vFP_End = AddMonths(vFP_Today,-1);
// e.g. 25
LET vFP_End_Year = RIGHT(YEAR(vFP_End),2);
// Pad month w/ a leading zero, i.e. 3 -> 03
LET vFP_End_Month = NUM(MONTH(vFP_End),'00');
SET vFP_End_FY_FP = fy$(vFP_End_Year)_fp$(vFP_End_Month);
END SUB;