<?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 Change Start of the day in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2471793#M67331</link>
    <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found a calendar with severals columns I need as indexDay, indexWeek... It works for a part of my sources, but I have some sources how don't start their day at 00:00 but at 05:00 AM.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried several things to change my start of the day but nothing change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need that my date (Day) start at 05:00 AM and end at 4:59 AM of the Day+1 and in concecuency my others periods follow this start and end. Ex : last IsoWeek have started on 04/11/22 at 5:00 AM and it end was on 04/18/22 at 4:59 AM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help me please?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date sort =
GENERATE (
CALENDAR( DATE( YEAR( TODAY() ) - 3, MONTH( TODAY() ), DAY( TODAY()) ), TODAY()),
VAR startOfWeek = 2 // Where 1 is Sunday and 7 is Saturday, thus a 3 would be Tuesday
VAR currentDay = [Date]
VAR days = DAY( currentDay )
VAR weeks = WEEKNUM(( currentDay ),21)
VAR months = MONTH ( currentDay )
VAR years = YEAR ( currentDay )
VAR nowYear = YEAR( TODAY() )
VAR nowMonth = MONTH( TODAY() )
VAR dayIndex = DATEDIFF( currentDay, TODAY(), DAY) * -1
VAR todayNum = WEEKDAY( TODAY(),2 )
VAR weekIndex = ROUNDDOWN((dayIndex + todayNum - startOfWeek - 5)/7,0)
//VAR weekinMonthIndex = (1 + WEEKNUM( currentDay ) - WEEKNUM( STARTOFMONTH (TODAY()),21))
RETURN ROW (
"day", days,
"month", FORMAT(months,"0#"),
"week", FORMAT(weeks,"0#"),
"year", years,
"day index", dayIndex,
"week index", weekIndex,
"month index", INT( (years - nowYear ) * 12 + months - nowMonth ),
"year index", INT( years - nowYear )
//"WeekinMonthIndex", weekinMonthIndex
)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Apr 2022 14:23:05 GMT</pubDate>
    <dc:creator>ItoDiaz</dc:creator>
    <dc:date>2022-04-22T14:23:05Z</dc:date>
    <item>
      <title>Change Start of the day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2471793#M67331</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found a calendar with severals columns I need as indexDay, indexWeek... It works for a part of my sources, but I have some sources how don't start their day at 00:00 but at 05:00 AM.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried several things to change my start of the day but nothing change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need that my date (Day) start at 05:00 AM and end at 4:59 AM of the Day+1 and in concecuency my others periods follow this start and end. Ex : last IsoWeek have started on 04/11/22 at 5:00 AM and it end was on 04/18/22 at 4:59 AM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help me please?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Date sort =
GENERATE (
CALENDAR( DATE( YEAR( TODAY() ) - 3, MONTH( TODAY() ), DAY( TODAY()) ), TODAY()),
VAR startOfWeek = 2 // Where 1 is Sunday and 7 is Saturday, thus a 3 would be Tuesday
VAR currentDay = [Date]
VAR days = DAY( currentDay )
VAR weeks = WEEKNUM(( currentDay ),21)
VAR months = MONTH ( currentDay )
VAR years = YEAR ( currentDay )
VAR nowYear = YEAR( TODAY() )
VAR nowMonth = MONTH( TODAY() )
VAR dayIndex = DATEDIFF( currentDay, TODAY(), DAY) * -1
VAR todayNum = WEEKDAY( TODAY(),2 )
VAR weekIndex = ROUNDDOWN((dayIndex + todayNum - startOfWeek - 5)/7,0)
//VAR weekinMonthIndex = (1 + WEEKNUM( currentDay ) - WEEKNUM( STARTOFMONTH (TODAY()),21))
RETURN ROW (
"day", days,
"month", FORMAT(months,"0#"),
"week", FORMAT(weeks,"0#"),
"year", years,
"day index", dayIndex,
"week index", weekIndex,
"month index", INT( (years - nowYear ) * 12 + months - nowMonth ),
"year index", INT( years - nowYear )
//"WeekinMonthIndex", weekinMonthIndex
)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 14:23:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2471793#M67331</guid>
      <dc:creator>ItoDiaz</dc:creator>
      <dc:date>2022-04-22T14:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change Start of the day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2472090#M67353</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="234607" data-lia-user-login="ItoDiaz" class="lia-mention lia-mention-user"&gt;ItoDiaz&lt;/a&gt; , You have create new date column in your tables and then join that with date table &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if(Timevalue([DateTime]) &amp;lt;time(5,0,0) , datevalue([Datetime]) -1, datevalue([Datetime]))&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 16:43:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2472090#M67353</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-04-22T16:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Change Start of the day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2474326#M67504</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your answer. Sorry I'm new using Dax and Power BI. I have done your suggestion, and of cours it works in my SourceTable,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;but I don't understand how I can use it to do my filters as I do everything with my DateSortTable&amp;nbsp;that don't change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you know, in my DateSortTable my VAR CurrentDay = [Date] is regarding the date column created by CALENDAR fonction and is this CurrentDay or the Start Hour in my CALENDAR function, I would like to change but the system don't propose me other options. I have tried to add 5/24 to my CALENDAR but it doesn't works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I create &lt;U&gt;all&lt;/U&gt; my DateSortTable into My SourceTable?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 08:37:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2474326#M67504</guid>
      <dc:creator>ItoDiaz</dc:creator>
      <dc:date>2022-04-25T08:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change Start of the day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2476535#M67635</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="234607" data-lia-user-login="ItoDiaz" class="lia-mention lia-mention-user"&gt;ItoDiaz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please add the column:&amp;nbsp;&lt;STRONG&gt;"NewDate", [Date] + TIME(5,0,0)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date sort = 
GENERATE (
CALENDAR( DATE( YEAR( TODAY() ) - 3, MONTH( TODAY() ), DAY( TODAY()) ), TODAY()),
VAR startOfWeek = 2 // Where 1 is Sunday and 7 is Saturday, thus a 3 would be Tuesday
VAR currentDay = [Date]
VAR days = DAY( currentDay )
VAR weeks = WEEKNUM(( currentDay ),21)
VAR months = MONTH ( currentDay )
VAR years = YEAR ( currentDay )
VAR nowYear = YEAR( TODAY() )
VAR nowMonth = MONTH( TODAY() )
VAR dayIndex = DATEDIFF( currentDay, TODAY(), DAY) * -1
VAR todayNum = WEEKDAY( TODAY(),2 )
VAR weekIndex = ROUNDDOWN((dayIndex + todayNum - startOfWeek - 5)/7,0)
//VAR weekinMonthIndex = (1 + WEEKNUM( currentDay ) - WEEKNUM( STARTOFMONTH (TODAY()),21))
RETURN ROW (
"day", days,
"month", FORMAT(months,"0#"),
"week", FORMAT(weeks,"0#"),
"year", years,
"day index", dayIndex,
"week index", weekIndex,
"month index", INT( (years - nowYear ) * 12 + months - nowMonth ),
"year index", INT( years - nowYear ),
//"WeekinMonthIndex", weekinMonthIndex
"NewDate", [Date] + TIME(5,0,0)
)
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.&lt;BR /&gt;Best Regards,&lt;BR /&gt;Winniz&lt;BR /&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 05:19:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2476535#M67635</guid>
      <dc:creator>v-kkf-msft</dc:creator>
      <dc:date>2022-04-26T05:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Change Start of the day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2482556#M68020</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="283692" data-lia-user-login="v-kkf-msft" class="lia-mention lia-mention-user"&gt;v-kkf-msft&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestion have helped me to solve my problem. I have created another VAR using your code&amp;nbsp;&lt;STRONG&gt;"NewDate", [Date] + TIME(5,0,0) &lt;/STRONG&gt;and I put this VAR as result of my CurrentDay and it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 08:29:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Change-Start-of-the-day/m-p/2482556#M68020</guid>
      <dc:creator>ItoDiaz</dc:creator>
      <dc:date>2022-04-28T08:29:04Z</dc:date>
    </item>
  </channel>
</rss>

