<?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: GENERATESERIES of Dates and round Hours in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799592#M88051</link>
    <description>&lt;P&gt;Hi Aniya,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you it does work!&lt;/P&gt;&lt;P&gt;In the meantime I came across this article with a similar solution, but I find yours more elegant &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;&lt;A href="https://community.powerbi.com/t5/Desktop/how-to-build-a-calendar-table-with-date-and-time/m-p/242658#M107662" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/how-to-build-a-calendar-table-with-date-and-time/m-p/242658#M107662&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 11:16:32 GMT</pubDate>
    <dc:creator>BLB</dc:creator>
    <dc:date>2022-09-27T11:16:32Z</dc:date>
    <item>
      <title>GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796658#M87890</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a data series with every round hour between two dates. I came up with the below DAX code, but after a certain date it starts returning ..... ..:59:59 instead of ..... ..:00:00 .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can somebody advise what is causing it and how to resolve it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;DateHour Master = &lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;VAR YearMinusOne = YEAR(NOW()) -1&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR YearPlusOne = &amp;nbsp;YEAR(NOW()) +1&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;GENERATESERIES (&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATE ( YearMinusOne, 1, 1 ),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATE ( YearPlusOne, 12, 31 ),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/24&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; )&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Sep 2022 14:04:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796658#M87890</guid>
      <dc:creator>BLB</dc:creator>
      <dc:date>2022-09-26T14:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796778#M87901</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="386482" data-lia-user-login="BLB" class="lia-mention lia-mention-user"&gt;BLB&lt;/a&gt;&amp;nbsp;Try this and then set your Value column to type Date/time.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DateHour Master = 
    VAR __YearMinusOne = YEAR(NOW()) - 1
    VAR __YearPlusOne = YEAR(NOW()) + 1
    VAR __Table =
        ADDCOLUMNS(
            GENERATESERIES(
                DATE(__YearMinusOne,1,1),
                DATE(__YearPlusOne, 12, 31),
                1/24
            ),
            "Date Time",ROUNDUP([Value],5)
        )
RETURN
    SELECTCOLUMNS(__Table,"Value",[Date Time])&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Sep 2022 14:37:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796778#M87901</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-26T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796994#M87910</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can also add a column&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;DateTime = &lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;('DateHour Master'[Value],&lt;/SPAN&gt;&lt;SPAN&gt;"dd/mm/yyyy hh:00:00"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;and it function&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;img /&gt;
&lt;P&gt;&lt;STRONG&gt;If this post is useful to help you to solve your issue consider giving the post a thumbs up&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and accepting it as a solution !&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Sep 2022 15:23:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2796994#M87910</guid>
      <dc:creator>serpiva64</dc:creator>
      <dc:date>2022-09-26T15:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2797165#M87926</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;, thank you for your prompt reply.&lt;/P&gt;&lt;P&gt;I tested it and it still behaves funny. In the generated table I can now see all the rounded dates&amp;amp;hours indeed. However, when I connect it with my fact table, it will not recognise some of the generated values, like the ones highlighted below: left column is from the fact table, right is from the generated table.&lt;/P&gt;&lt;P&gt;Do you have any suggestion why?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 16:05:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2797165#M87926</guid>
      <dc:creator>BLB</dc:creator>
      <dc:date>2022-09-26T16:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2797179#M87930</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="386482" data-lia-user-login="BLB" class="lia-mention lia-mention-user"&gt;BLB&lt;/a&gt;&amp;nbsp;How about this?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DateHour Master = 
    VAR __YearMinusOne = YEAR(NOW()) - 1
    VAR __YearPlusOne = YEAR(NOW()) + 1
    VAR __Table =
        ADDCOLUMNS(
            GENERATESERIES(
                DATE(__YearMinusOne,1,1),
                DATE(__YearPlusOne, 12, 31),
                1/24
            ),
            "Date Time",DATE(YEAR([Value]),MONTH([Value]),DAY([Value])) + TIME(HOUR([Value]),0,0)
        )
RETURN
    SELECTCOLUMNS(__Table,"Value",[Date Time])&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Sep 2022 16:10:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2797179#M87930</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-09-26T16:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2798322#M87992</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="386482" data-lia-user-login="BLB" class="lia-mention lia-mention-user"&gt;BLB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you wabt to&amp;nbsp;&lt;SPAN&gt;create a data series with every round hour between two dates.Right?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here are the steps you can follow:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(1)This is my test data to situmulate your fact table:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2)We can click "New table" and enter this dax:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DateHour Master = 
    VAR __YearMinusOne = YEAR(TODAY()) - 1
    VAR __YearPlusOne = YEAR(TODAY())+1 
    VAR __Table =
            CALENDAR(DATE(__YearMinusOne,1,1),DATE(__YearPlusOne,12,31))
    var _time= SELECTCOLUMNS( GENERATESERIES(
    Time(0,0,0),
    TIME(23,0,0),
        1/24) , "time", [Value] )
    var _t = CROSSJOIN(__Table,_time)
RETURN
   SELECTCOLUMNS( ADDCOLUMNS(_t,"tt",[Date]+[time]) ,"DateTime" , [tt])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3)Then we can get the table and create relationship between two tables, the result is as follows:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 02:47:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2798322#M87992</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-27T02:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799537#M88048</link>
      <description>&lt;P&gt;Thanks but still something weird keeps happinging with this. Somehow it generates the value&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;20/01/2021 21:00:00&lt;/STRONG&gt;&lt;/EM&gt; twice!&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 10:46:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799537#M88048</guid>
      <dc:creator>BLB</dc:creator>
      <dc:date>2022-09-27T10:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799569#M88049</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="96253" data-lia-user-login="serpiva64" class="lia-mention lia-mention-user"&gt;serpiva64&lt;/a&gt;&amp;nbsp;it does work, thank you!&lt;/P&gt;&lt;P&gt;But I don't really understand how the formatting will result in rounding - can you please explain, e.g. why will 11:59:59 turn into 12:00:00?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 11:07:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799569#M88049</guid>
      <dc:creator>BLB</dc:creator>
      <dc:date>2022-09-27T11:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: GENERATESERIES of Dates and round Hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799592#M88051</link>
      <description>&lt;P&gt;Hi Aniya,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you it does work!&lt;/P&gt;&lt;P&gt;In the meantime I came across this article with a similar solution, but I find yours more elegant &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;&lt;A href="https://community.powerbi.com/t5/Desktop/how-to-build-a-calendar-table-with-date-and-time/m-p/242658#M107662" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/how-to-build-a-calendar-table-with-date-and-time/m-p/242658#M107662&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 11:16:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/GENERATESERIES-of-Dates-and-round-Hours/m-p/2799592#M88051</guid>
      <dc:creator>BLB</dc:creator>
      <dc:date>2022-09-27T11:16:32Z</dc:date>
    </item>
  </channel>
</rss>

