<?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: Custom calendar in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812570#M154392</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920855" data-lia-user-login="SundarRaj" class="lia-mention lia-mention-user"&gt;SundarRaj&lt;/a&gt;&amp;nbsp;, did you post the correct file with your changes?&lt;BR /&gt;I don't see any difference with mine.&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="685422" data-lia-user-login="tharunkumarRTK" class="lia-mention lia-mention-user"&gt;tharunkumarRTK&lt;/a&gt;&amp;nbsp;,thank you very much, I took inspiration from your last two lines of code and integrated them into mine.&amp;nbsp;It works well (see new &lt;A href="https://we.tl/t-w0RGG3w5Er" target="_blank"&gt;file&lt;/A&gt;)&lt;BR /&gt;I think I'll adapt the number of weeks to ISO to start from a full week.&lt;BR /&gt;My only problem is that I have to manually modify this part "#duration(26,0,0,0)", so that the first of the last four weeks starts on a Monday.&lt;/P&gt;&lt;P&gt;I'm waiting to see the solution from&amp;nbsp;SundarRaj&amp;nbsp;to see which solution to go with.&lt;BR /&gt;Best regards&lt;/P&gt;</description>
    <pubDate>Sun, 31 Aug 2025 16:46:40 GMT</pubDate>
    <dc:creator>Mederic</dc:creator>
    <dc:date>2025-08-31T16:46:40Z</dc:date>
    <item>
      <title>Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812301#M154385</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I would like to customise a calendar that has a certain number of columns.&lt;BR /&gt;I am unable to adapt the M code for the two columns ‘Weeks Nr.’ and ‘Range Days’.&lt;BR /&gt;The ultimate goal is to create a pivot table that looks like the one in the attached &lt;A href="https://we.tl/t-CR4oHROkhS" target="_self"&gt;file&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If you have a better presentation for the pivot table, I would be interested.&lt;BR /&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2025 19:29:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812301#M154385</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-08-30T19:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812401#M154387</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="524456" data-lia-user-login="Mederic" class="lia-mention lia-mention-user"&gt;Mederic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As the expected result you mentioned in file you shared&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You can follow this appraoch&lt;/P&gt;
&lt;P&gt;(I considered wednesday as week start day)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
  Source = List.Dates(#date(2023,1,1),1100,#duration(1,0,0,0)),
  #"Converted to table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
  #"Changed column type" = Table.TransformColumnTypes(#"Converted to table", {{"Column1", type date}}),
  #"Renamed columns" = Table.RenameColumns(#"Changed column type", {{"Column1", "Date"}}),
  #"Added custom" = Table.TransformColumnTypes(Table.AddColumn(#"Renamed columns", "Year", each Date.Year([Date])), {{"Year", Int64.Type}}),
  #"Added custom 1" = Table.TransformColumnTypes(Table.AddColumn(#"Added custom", "Month Nr", each Date.Month([Date])), {{"Month Nr", Int64.Type}}),
  #"Added custom 2" = Table.TransformColumnTypes(Table.AddColumn(#"Added custom 1", "Month Name", each Date.MonthName([Date])), {{"Month Name", type text}}),
  #"Added custom 3" = Table.TransformColumnTypes(Table.AddColumn(#"Added custom 2", "Week Nr", each if [Date] &amp;lt; Date.From((DateTime.LocalNow() - #duration(28,0,0,0))) then [Year] else Date.WeekOfYear([Date])), {{"Week Nr", Int64.Type}}),
  #"Added custom 4" = Table.AddColumn(#"Added custom 3", "Range", each if [Date] &amp;lt; Date.From((DateTime.LocalNow() - #duration(28,0,0,0))) then "" else Text.From (Date.Day(Date.StartOfWeek([Date], Day.Wednesday))) &amp;amp; "-" &amp;amp; Text.From (Date.Day(Date.EndOfWeek([Date], Day.Wednesday))))
in
  #"Added custom 4"&lt;/LI-CODE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Connect on &lt;A href="https://www.linkedin.com/in/tharun-kumar-ravikrindhi/" target="_blank" rel="noopener"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV style="border-radius: 1px; padding: 10px; border: solid #cccccc 1px; background: #fafafa no-repeat right 10px center;"&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;If I helped you, click on the Thumbs Up to give Kudos.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;P style="padding: 0; margin: 5px 50px 0 0;"&gt;Proud to be a Super User!&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 05:33:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812401#M154387</guid>
      <dc:creator>tharunkumarRTK</dc:creator>
      <dc:date>2025-08-31T05:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812402#M154388</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="524456" data-lia-user-login="Mederic" class="lia-mention lia-mention-user"&gt;Mederic&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;I'll attach the same file you sent with some transformations. Do let me know if that's you were looking for and if I misunderstood, do let me know. Thanks&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 05:34:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812402#M154388</guid>
      <dc:creator>SundarRaj</dc:creator>
      <dc:date>2025-08-31T05:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812425#M154390</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920855" data-lia-user-login="SundarRaj" class="lia-mention lia-mention-user"&gt;SundarRaj&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="685422" data-lia-user-login="tharunkumarRTK" class="lia-mention lia-mention-user"&gt;tharunkumarRTK&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you very much for your suggestions.&lt;BR /&gt;As I will be looking at each of the responses in detail,&lt;BR /&gt;I will get back to you later today.&lt;BR /&gt;Thank you again.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 07:15:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812425#M154390</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-08-31T07:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812570#M154392</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920855" data-lia-user-login="SundarRaj" class="lia-mention lia-mention-user"&gt;SundarRaj&lt;/a&gt;&amp;nbsp;, did you post the correct file with your changes?&lt;BR /&gt;I don't see any difference with mine.&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="685422" data-lia-user-login="tharunkumarRTK" class="lia-mention lia-mention-user"&gt;tharunkumarRTK&lt;/a&gt;&amp;nbsp;,thank you very much, I took inspiration from your last two lines of code and integrated them into mine.&amp;nbsp;It works well (see new &lt;A href="https://we.tl/t-w0RGG3w5Er" target="_blank"&gt;file&lt;/A&gt;)&lt;BR /&gt;I think I'll adapt the number of weeks to ISO to start from a full week.&lt;BR /&gt;My only problem is that I have to manually modify this part "#duration(26,0,0,0)", so that the first of the last four weeks starts on a Monday.&lt;/P&gt;&lt;P&gt;I'm waiting to see the solution from&amp;nbsp;SundarRaj&amp;nbsp;to see which solution to go with.&lt;BR /&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 16:46:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812570#M154392</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-08-31T16:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812615#M154393</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="524456" data-lia-user-login="Mederic" class="lia-mention lia-mention-user"&gt;Mederic&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;I'm sorry for sending out the original file (no changes). I'll attach the file with the transformations. Also, with respect to the selecting the first of the four weeks that starts on a Monday is also incorporated here. Here is the image below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here is the output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 20:02:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812615#M154393</guid>
      <dc:creator>SundarRaj</dc:creator>
      <dc:date>2025-08-31T20:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812619#M154394</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920855" data-lia-user-login="SundarRaj" class="lia-mention lia-mention-user"&gt;SundarRaj&lt;/a&gt;&amp;nbsp;, no worries, thank you very much for this file.&lt;BR /&gt;I'll take the time to look at it tomorrow when I get back from work.&lt;BR /&gt;In any case, it looks good to me and I'll get back to you tomorrow evening.&lt;/P&gt;&lt;P&gt;Have a nice evening&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 20:17:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812619#M154394</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-08-31T20:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812634#M154395</link>
      <description>&lt;P&gt;How about this as a pivot table presentation:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I stayed with Wednesday being the start of a week so that my results match your results.&lt;/P&gt;
&lt;P&gt;Change your end date in cell 'end' to one within the first 2 or 3 weeks of the year to see what happens when you refresh the pivot at cell V13.&lt;/P&gt;
&lt;P&gt;See the &lt;EM&gt;calendar&lt;/EM&gt; query in the attached which outputs directly to the pivot.&lt;/P&gt;
&lt;P&gt;Hope it gives you some ideas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Note, that if you want the week to begin on a Monday, there are 2 places where you need to change that:&lt;/P&gt;
&lt;P&gt;1. The first step called&amp;nbsp;&lt;EM&gt;FirstDateOfWeekNos&lt;/EM&gt; where you change&amp;nbsp;&lt;FONT face="courier new,courier" color="#0000FF"&gt;Day.Wednesday&lt;/FONT&gt; to&amp;nbsp;&lt;FONT face="courier new,courier" color="#0000FF"&gt;Day.Monday&lt;/FONT&gt; (or just delete Day.Wednesday and its preceding comma since Monday is the default if you don't supply that argument), and&lt;/P&gt;
&lt;P&gt;2. The step called&amp;nbsp;&lt;EM&gt;Inserted Start of Week&lt;/EM&gt; where you do the same.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2025 22:31:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4812634#M154395</guid>
      <dc:creator>p45cal</dc:creator>
      <dc:date>2025-08-31T22:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4813785#M154417</link>
      <description>&lt;P&gt;Good evening everyone,&lt;BR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920855" data-lia-user-login="SundarRaj" class="lia-mention lia-mention-user"&gt;SundarRaj&lt;/a&gt;&amp;nbsp;&amp;nbsp;Thank you for your solution, which I have just looked at. The proposal is interesting, but as mentioned by jaineshp&amp;nbsp;, I am starting from Power query Editor and not from an existing table in Excel.&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1284569" data-lia-user-login="jaineshp" class="lia-mention lia-mention-user"&gt;jaineshp&lt;/a&gt;&amp;nbsp;&amp;nbsp;Thank you for summarising the steps clearly.&lt;BR /&gt;That is indeed the approach to take.&amp;nbsp;The same as pa4cal, but removing the "Weeks Nr" column, which is no longer needed.&lt;BR /&gt;I will therefore use his solution&lt;BR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="719629" data-lia-user-login="p45cal" class="lia-mention lia-mention-user"&gt;p45cal&lt;/a&gt;&amp;nbsp;, that's perfect, thank you very much.&lt;/P&gt;&lt;P&gt;I appreciated the approach you suggested.&lt;BR /&gt;Here is the &lt;A href="https://we.tl/t-3afP9jrL8K" target="_self"&gt;resul&lt;/A&gt;t with 3 full weeks + the last week up to the "end" date.&lt;/P&gt;&lt;P&gt;Thank you all.&lt;BR /&gt;Have a good evening.&lt;/P&gt;&lt;P&gt;Translated with DeepL.com (free version)&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2025 19:01:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4813785#M154417</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-09-01T19:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4814430#M154433</link>
      <description>&lt;P&gt;I foresee a hiccup with the likes of&amp;nbsp;#duration(26,0,0,0).&lt;/P&gt;
&lt;P&gt;If you change the end date you will not necessarily get the full week that the pivot table implies.&lt;/P&gt;
&lt;P&gt;Example: Change the end date to 15th Jan 2025 and you get this pivot:&lt;/P&gt;
&lt;P&gt;where the data in the red rectangle implies a full week, but it's not:&lt;/P&gt;
&lt;DIV id="tinyMceEditor_712c1dfdeddc15p45cal_3" class=""&gt;&amp;nbsp;&lt;img /&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;
&lt;P&gt;The 18th and 19th Dec 2024 values are not included in the 30, it should be 36.&lt;/P&gt;
&lt;P&gt;This is what the query looks like:&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if (x) &amp;lt; Date.AddWeeks(Date.StartOfWeek(end, Day.Wednesday),-4) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;which will guarantee a full week's data is included&lt;/P&gt;
&lt;P&gt;then the pivot becomes:&lt;/P&gt;
&lt;img /&gt;
&lt;P&gt;I note also that you wanted 4 weeks data at the end, not 5; changing &lt;FONT color="#FF0000"&gt;-4&lt;/FONT&gt; to &lt;FONT color="#FF0000"&gt;-3&lt;/FONT&gt; will put that right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Sep 2025 10:27:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4814430#M154433</guid>
      <dc:creator>p45cal</dc:creator>
      <dc:date>2025-09-02T10:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Custom calendar</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4814946#M154455</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="719629" data-lia-user-login="p45cal" class="lia-mention lia-mention-user"&gt;p45cal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for pointing out and correcting the problem.&lt;BR /&gt;I did indeed have it in the back of my mind.&lt;BR /&gt;I just tested it with a few dates and it works with the full period from Sunday to Saturday.&lt;BR /&gt;I no longer have to worry about manually changing the previous condition.&lt;BR /&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Tue, 02 Sep 2025 17:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Custom-calendar/m-p/4814946#M154455</guid>
      <dc:creator>Mederic</dc:creator>
      <dc:date>2025-09-02T17:50:25Z</dc:date>
    </item>
  </channel>
</rss>

