Forum Discussion

THEG72's avatar
THEG72
Helper V
6 years ago
Solved

Calendar Fiscal Year Offset M Code for Function

Hi Community,   I have a calendar function and I need to work out how to get the Fiscal Year Offset. I understand I need the current date to extract the current fiscal year but I can't work out the...
  • Mariusz's avatar
    6 years ago

    Hi THEG72 

     

    Add this to your code

    FiscalYearOffset = Table.AddColumn( CurrentYearOffset, "FiscalYearOffset", each [Fiscal Year] - List.Max( Table.SelectRows( CurrentQuarterOffset, (a) => a[Date] = CurrentDate )[Fiscal Year] ) , Int64.Type )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.