<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Various fiscal periods in Calendar table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293822#M170416</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="856559" data-lia-user-login="aggysmith" class="lia-mention lia-mention-user"&gt;aggysmith&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create the Calculated Column for Fiscal Periods&lt;/P&gt;&lt;PRE&gt;FiscalPeriod = &lt;BR /&gt;VAR StartOfFiscalYear = DATE(YEAR('Calendar'[Date]) - IF(MONTH('Calendar'[Date]) &amp;lt; 11, 1, 0), 11, 1)&lt;BR /&gt;VAR DayOfYear = DATEDIFF(StartOfFiscalYear, 'Calendar'[Date], DAY)&lt;BR /&gt;VAR FiscalPattern = SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;YEAR('Calendar'[Date]) = 2024, "4-4-5",&lt;BR /&gt;YEAR('Calendar'[Date]) = 2025, "4-5-4",&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;SWITCH(&lt;BR /&gt;FiscalPattern,&lt;BR /&gt;"4-4-5",&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;DayOfYear &amp;lt;= 28, "P01",&lt;BR /&gt;DayOfYear &amp;lt;= 56, "P02",&lt;BR /&gt;DayOfYear &amp;lt;= 91, "P03",&lt;BR /&gt;DayOfYear &amp;lt;= 119, "P04",&lt;BR /&gt;DayOfYear &amp;lt;= 147, "P05",&lt;BR /&gt;DayOfYear &amp;lt;= 182, "P06",&lt;BR /&gt;DayOfYear &amp;lt;= 210, "P07",&lt;BR /&gt;DayOfYear &amp;lt;= 238, "P08",&lt;BR /&gt;DayOfYear &amp;lt;= 273, "P09",&lt;BR /&gt;DayOfYear &amp;lt;= 301, "P10",&lt;BR /&gt;DayOfYear &amp;lt;= 329, "P11",&lt;BR /&gt;"P12"&lt;BR /&gt;),&lt;BR /&gt;"4-5-4",&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;DayOfYear &amp;lt;= 28, "P01",&lt;BR /&gt;DayOfYear &amp;lt;= 63, "P02",&lt;BR /&gt;DayOfYear &amp;lt;= 91, "P03",&lt;BR /&gt;DayOfYear &amp;lt;= 126, "P04",&lt;BR /&gt;DayOfYear &amp;lt;= 154, "P05",&lt;BR /&gt;DayOfYear &amp;lt;= 189, "P06",&lt;BR /&gt;DayOfYear &amp;lt;= 217, "P07",&lt;BR /&gt;DayOfYear &amp;lt;= 252, "P08",&lt;BR /&gt;DayOfYear &amp;lt;= 280, "P09",&lt;BR /&gt;DayOfYear &amp;lt;= 315, "P10",&lt;BR /&gt;DayOfYear &amp;lt;= 343, "P11",&lt;BR /&gt;"P12"&lt;BR /&gt;),&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;Add another calculated column for quarters:&lt;/P&gt;&lt;PRE&gt;FiscalQuarter = &lt;BR /&gt;SWITCH(&lt;BR /&gt;'Calendar'[FiscalPeriod],&lt;BR /&gt;"P01", "Q1",&lt;BR /&gt;"P02", "Q1",&lt;BR /&gt;"P03", "Q1",&lt;BR /&gt;"P04", "Q2",&lt;BR /&gt;"P05", "Q2",&lt;BR /&gt;"P06", "Q2",&lt;BR /&gt;"P07", "Q3",&lt;BR /&gt;"P08", "Q3",&lt;BR /&gt;"P09", "Q3",&lt;BR /&gt;"P10", "Q4",&lt;BR /&gt;"P11", "Q4",&lt;BR /&gt;"P12", "Q4",&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Kedar&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2024 17:28:00 GMT</pubDate>
    <dc:creator>Kedar_Pande</dc:creator>
    <dc:date>2024-11-20T17:28:00Z</dc:date>
    <item>
      <title>Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293379#M170388</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to add a column with fiscal periods P01 to P12. The tricky bit is that we have 4 and 5 week periods, but still only 12 periods in Financial year. P01 and P12 are usually more or less than 7 days weeks to fit within the financial year brackets.&lt;/P&gt;&lt;P&gt;Our Financial year starts on 01/11 and ends 31/10.&lt;/P&gt;&lt;P&gt;Another complication is that some periods are 4 some 5 weeks long, so we can catch up with 12 periods fiscal year and not eavey year is the same. For example FY24 was 4 week - 4 week - 5 week ... 4-4-5...4-4-5...4-4-5 pattern..., but FY25 is&amp;nbsp;4-5-4...4-5-4...4-5-4...4-5-4.&lt;/P&gt;&lt;P&gt;Is there a DAX formula that will enable me to create this patterns in Power BI instead of uploading manual excel file with the Period number.&lt;/P&gt;&lt;P&gt;Could I also use similar logic for the Quarter numbers as they will be dependant on Period numbers rather than actual date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 13:17:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293379#M170388</guid>
      <dc:creator>aggysmith</dc:creator>
      <dc:date>2024-11-20T13:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293395#M170389</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="856559" data-lia-user-login="aggysmith" class="lia-mention lia-mention-user"&gt;aggysmith&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please try this approach:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Fiscal Period = 
VAR FiscalStartDate = DATE(YEAR('Calendar'[Date]) - IF(MONTH('Calendar'[Date]) &amp;lt; 11, 1, 0), 11, 1)
VAR DaysSinceFiscalStart = DATEDIFF(FiscalStartDate, 'Calendar'[Date], DAY)

VAR PeriodPattern = "445445445445"

VAR CumulativeDays = 
    GENERATESERIES(0, 364, 28) + -- For 4 weeks
    GENERATESERIES(28, 364, 35) -- For 5 weeks

VAR PeriodNumber = 
    LOOKUPVALUE(
        [Period],
        [DaysThreshold], TRUE,
        [DaysSinceFiscalStart] &amp;lt;= [CumulativeDays]
    )
RETURN
PeriodNumber
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Nov 2024 13:27:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293395#M170389</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2024-11-20T13:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293446#M170395</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="501067" data-lia-user-login="Sahir_Maharaj" class="lia-mention lia-mention-user"&gt;Sahir_Maharaj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your prompt advise.&lt;/P&gt;&lt;P&gt;I used the solution as sugested, but clearly am missing sumthing (perhaps not as advanced in Power BI and hence dont quite understand).&lt;/P&gt;&lt;P&gt;I keep getting error and this is due to the bottom section of your solution&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I'm not quite sure where to take it from here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any fiurther advice will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 13:56:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293446#M170395</guid>
      <dc:creator>aggysmith</dc:creator>
      <dc:date>2024-11-20T13:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293822#M170416</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="856559" data-lia-user-login="aggysmith" class="lia-mention lia-mention-user"&gt;aggysmith&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create the Calculated Column for Fiscal Periods&lt;/P&gt;&lt;PRE&gt;FiscalPeriod = &lt;BR /&gt;VAR StartOfFiscalYear = DATE(YEAR('Calendar'[Date]) - IF(MONTH('Calendar'[Date]) &amp;lt; 11, 1, 0), 11, 1)&lt;BR /&gt;VAR DayOfYear = DATEDIFF(StartOfFiscalYear, 'Calendar'[Date], DAY)&lt;BR /&gt;VAR FiscalPattern = SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;YEAR('Calendar'[Date]) = 2024, "4-4-5",&lt;BR /&gt;YEAR('Calendar'[Date]) = 2025, "4-5-4",&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;RETURN&lt;BR /&gt;SWITCH(&lt;BR /&gt;FiscalPattern,&lt;BR /&gt;"4-4-5",&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;DayOfYear &amp;lt;= 28, "P01",&lt;BR /&gt;DayOfYear &amp;lt;= 56, "P02",&lt;BR /&gt;DayOfYear &amp;lt;= 91, "P03",&lt;BR /&gt;DayOfYear &amp;lt;= 119, "P04",&lt;BR /&gt;DayOfYear &amp;lt;= 147, "P05",&lt;BR /&gt;DayOfYear &amp;lt;= 182, "P06",&lt;BR /&gt;DayOfYear &amp;lt;= 210, "P07",&lt;BR /&gt;DayOfYear &amp;lt;= 238, "P08",&lt;BR /&gt;DayOfYear &amp;lt;= 273, "P09",&lt;BR /&gt;DayOfYear &amp;lt;= 301, "P10",&lt;BR /&gt;DayOfYear &amp;lt;= 329, "P11",&lt;BR /&gt;"P12"&lt;BR /&gt;),&lt;BR /&gt;"4-5-4",&lt;BR /&gt;SWITCH(&lt;BR /&gt;TRUE(),&lt;BR /&gt;DayOfYear &amp;lt;= 28, "P01",&lt;BR /&gt;DayOfYear &amp;lt;= 63, "P02",&lt;BR /&gt;DayOfYear &amp;lt;= 91, "P03",&lt;BR /&gt;DayOfYear &amp;lt;= 126, "P04",&lt;BR /&gt;DayOfYear &amp;lt;= 154, "P05",&lt;BR /&gt;DayOfYear &amp;lt;= 189, "P06",&lt;BR /&gt;DayOfYear &amp;lt;= 217, "P07",&lt;BR /&gt;DayOfYear &amp;lt;= 252, "P08",&lt;BR /&gt;DayOfYear &amp;lt;= 280, "P09",&lt;BR /&gt;DayOfYear &amp;lt;= 315, "P10",&lt;BR /&gt;DayOfYear &amp;lt;= 343, "P11",&lt;BR /&gt;"P12"&lt;BR /&gt;),&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;Add another calculated column for quarters:&lt;/P&gt;&lt;PRE&gt;FiscalQuarter = &lt;BR /&gt;SWITCH(&lt;BR /&gt;'Calendar'[FiscalPeriod],&lt;BR /&gt;"P01", "Q1",&lt;BR /&gt;"P02", "Q1",&lt;BR /&gt;"P03", "Q1",&lt;BR /&gt;"P04", "Q2",&lt;BR /&gt;"P05", "Q2",&lt;BR /&gt;"P06", "Q2",&lt;BR /&gt;"P07", "Q3",&lt;BR /&gt;"P08", "Q3",&lt;BR /&gt;"P09", "Q3",&lt;BR /&gt;"P10", "Q4",&lt;BR /&gt;"P11", "Q4",&lt;BR /&gt;"P12", "Q4",&lt;BR /&gt;BLANK()&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Kedar&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 17:28:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4293822#M170416</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-11-20T17:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4294390#M170435</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi All,&lt;BR /&gt;Firstly&amp;nbsp; Kedar_Pande and Sahir_Maharaj thank you for yours solutions!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="856559" data-lia-user-login="aggysmith" class="lia-mention lia-mention-user"&gt;aggysmith&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;As I understand it you want to form a new FY column based on Nov 1 to Oct 31 and give them P01 to P12 values according to the pattern you need, and then form a new FY quarterly column based on that, right?&lt;BR /&gt;Here are some of my thoughts I used November 1, 2024 to October 31, 2025 as an example, hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Fiscal Period = 
VAR FYStartDate = DATE(
    IF(MONTH('CalendarTable'[Date]) &amp;gt;= 11, YEAR('CalendarTable'[Date]), YEAR('CalendarTable'[Date]) - 1),
    11, 1
)
VAR CurrentDate = 'CalendarTable'[Date]
VAR DaysSinceFYStart = DATEDIFF(FYStartDate, CurrentDate, DAY)
VAR TotalWeeks = QUOTIENT(DaysSinceFYStart, 7) + 1
VAR Pattern = 
    IF(
        MOD(YEAR(FYStartDate), 2) = 0, // 
        "445445445445",
        "454454454454"  // 
    )
VAR WeekOffsets = 
    ADDCOLUMNS(
        GENERATESERIES(1, 12, 1),
        "Weeks",
        SWITCH(
            VALUE(MID(Pattern, [Value], 1)),
            4, 4,
            5, 5,
            0
        )
    )
VAR StartWeeks = 
    ADDCOLUMNS(
        WeekOffsets,
        "StartWeek", SUMX(
            FILTER(WeekOffsets, [Value] &amp;lt; EARLIER([Value])),
            [Weeks]
        ) + 1,
        "EndWeek", SUMX(
            FILTER(WeekOffsets, [Value] &amp;lt;= EARLIER([Value])),
            [Weeks]
        )
    )
VAR PeriodNumber = 
    MAXX(
        FILTER(
            StartWeeks,
            TotalWeeks &amp;gt;= [StartWeek] &amp;amp;&amp;amp; TotalWeeks &amp;lt;= [EndWeek]
        ),
        [Value]
    )
RETURN "P" &amp;amp; FORMAT(PeriodNumber, "00")

&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Fiscal Quarter = "Q" &amp;amp; ROUNDUP(
    VALUE(SUBSTITUTE('CalendarTable'[Fiscal Period], "P", "0"))  / 3,0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you have further questions, you can check the Pbix file I uploaded, I hope my solution can solve your problem, if I can solve your problem I will be honored!&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Tom Shen&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 03:04:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4294390#M170435</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-21T03:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Various fiscal periods in Calendar table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4294999#M170465</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, thank you for your solution, this is the closest to make my various weeks paterns in periods work. The last remining issue is the inconsistent lenght of week 1 of the fiscal year and week 52, both of which have non standard lenght of more or less than 7 days.&lt;/P&gt;&lt;P&gt;Standard period begins on Monday and ends after 4 weeks on a Friday, however , because the FY25 started on a Friday, the 1st week week will go all the way till 8th of November and therefore the last day of P01 should be a Friday as well, 29th November.&amp;nbsp; P02 should then start on a Sturday 30th November.&lt;/P&gt;&lt;P&gt;Similar situation would be at the end of each october (in 2026 it's luckly finishing on a Friday, but future years would be a problem in FY24 week 52 was 13 days long). In your solution also the very last day does only come up with a "P", but no period number attached to it. Which i think has something to do with the extra day in P01&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I have is also making it work for all the future years. The nature of our business is long term planning of the property development workflow and some projects can take as long as 10 years +. To make this model future proof, I need to make this paterns work up untill at least 2050.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is beyond my Power BI competence, so really hoping for yours and others expertise &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 09:28:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Various-fiscal-periods-in-Calendar-table/m-p/4294999#M170465</guid>
      <dc:creator>aggysmith</dc:creator>
      <dc:date>2024-11-21T09:28:27Z</dc:date>
    </item>
  </channel>
</rss>

