Custom Fiscal Year Month

Hi ALL & @Melissa

I am looking for a custom Fiscal Year month Calculation in Power query , wherein my Fiscal Month should start from the week ignoring the 31st week of previous year.
Example - in 2021 the 1st and 2nd were part of 31st of previous year so these dates should be ignored and my 1st week should start from 3rd Jan 2021.

Also my Fiscal Year Month for 1 month of each quarter should be of 5 weeks and remaining should be 4 weeks in that quarter i.e. Fiscal Year Month of Jan 21 should start on 3rd Jan 2021 and end on 6th Feb 2021 so the dates between specified period should be part of Fiscal Year Month Jan 21.

Similar 2nd Quarter 1st Month i.e. Apr 21 should start from 4th Apr and end on 8th May making it total of 5 week and named as Fiscal year Month Apr 21 and consecutive months of that quarter should of 4 weeks , similar behavior should be for 1st month of each quarter.

Attached is the pbix for the same with date table imported.
Sample Custom Fiscal Month.pbix (65.5 KB)

(@Melissa - It would be great if you can help me with the same)

Hi @Vishy,

Please see how you get on with this date table M query.
It requires 2 parameter, a StartDate for your first FY, in your case = 3 jan 2021 and how many years you want to include in your date table.

let fx544DateTable = (StartDate as date, NumOfYears as number) as table =>
    let
        EndDate = Date.AddDays( StartDate, (NumOfYears * 364 ) -1 ),
        Source = Table.FromColumns( {{ Number.From(StartDate)..Number.From(EndDate) }} ),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}}),
        #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),
        #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "DayID", 1, 1, Int64.Type),
        AddFY = Table.AddColumn(#"Added Index", "FY ID", each Number.RoundDown(([DayID]-1)/364)+1, type number),
        AddFQ = Table.AddColumn(AddFY, "FQ ID", each Number.RoundDown(([DayID]-1)/91)+1, type number),
        AddFP = Table.AddColumn(AddFQ, "FP ID", each Number.RoundDown([DayID]/91) * 3 +
                (   if Number.Mod([DayID],91)=0 then 0
                    else if Number.Mod([DayID],91)<=35 then 1
                    else if Number.Mod([DayID],91)<=63 then 2
                    else 3
                ), 
            type number ),
        AddFW = Table.AddColumn(AddFP, "FW ID", each Number.RoundDown(([DayID]-1)/7)+1, type number),
        FiscalYear = Table.AddColumn(AddFW, "FY", each Date.Year( StartDate ) + [FY ID] -1, type number),
        FiscalQuarter = Table.AddColumn(FiscalYear, "FQ", each [FQ ID]-(([FY ID]-1)*4), type number),
        FiscalPeriod = Table.AddColumn(FiscalQuarter, "FP", each [FP ID] - (([FY ID]-1) * 12 ), type number),
        FiscalWeek = Table.AddColumn(FiscalPeriod, "FW", each [FW ID] - (([FY ID]-1) * 52 ), type number),
        QinFY = Table.AddColumn(FiscalWeek, "Quarter in FY", each Text.From([FY]) & " - Q" & Text.From([FQ]), type text),
        PinFY = Table.AddColumn(QinFY, "Period in FY", each Text.From([FY]) & " - P" & Text.PadStart( Text.From([FP]), 2, "0"), type text),
        WinFY = Table.AddColumn(PinFY, "Week in FY", each Text.From([FY]) & " - W" & Text.PadStart( Text.From([FW]), 2, "0"), type text)
    in
        WinFY
in  fx544DateTable

You can extent the code however you see fit. This article forms the basis of this 544 date table M code.
I hope this is helpful.

1 Like

Thanks @Melissa , it worked well for me just that i had to replace StartDateFirstFY with Start date as the variable name declared was StartDate , and everything perfect. Thanks so much.
However for this communities Knowledge purpose , I required this 544 date table to calculate target from the same Fact table that is used to calculate Actuals.

Approach that I used is

  1. Imported both date table the normal one and the 544.
  2. Then created a Month Dim table which has a relationship with 544 and date dim.
  3. Created an inactive relationship with 544 and fact table to calculate the targets based on 544 dates.
  4. Pulled in Actuals and target value against Month dim which help me successfully achieve actuals and targets from the same Fact table but based on different date table.

Attaching the pbi for every body’s reference
Sample report_v2 - Copy.pbix (276.4 KB)

Refer to “Target & Actuals” Page