Anonymous
Not applicable

@Jason Johnson​ :

It seems that the fiscalyear library you are using is actually setting the start month to July (month 7) instead of April (month 4) as you intended. This might be a bug or a known issue with the library.

To work around this, you can manually adjust the month of your date inputs to compensate for the offset. For example, you can subtract 3 from the month of your start date to shift it back to April:

start_date = '2016-01-01'
start_date = f'{start_date[:5]}{int(start_date[5:7])-3:02d}{start_date[7:]}'
 
# start_date is now '2016-04-01'

Similarly, you can subtract 3 from the month of your fiscal year calculation to get the correct fiscal month:

udf_f_m = udf(lambda CELL: fiscalyear.FiscalDateTime(CELL.year, CELL.month, CELL.day).fiscal_month - 3)

With these adjustments, your code should correctly generate a calendar dimension with a fiscal year starting in April.