<?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: Add new rows to table based on date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2509202#M69560</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You need to create a table that combine [date] and [type] .&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then merage the Type table and dynamic date table in Query Editor to get a new table .&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then expand the new table and you will get a table like this :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Next you can create a [visual date] column according to [type] column .&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;visual date =
var _week=Merge1[Date]-WEEKDAY(Merge1[Date],2)+1
var _month=EOMONTH(Merge1[Date],-1)+1
return SWITCH(TRUE(),Merge1[Type.Type]="Day",Merge1[Date],Merge1[Type.Type]="Week",_week,Merge1[Type.Type]="Month",_month)&lt;/LI-CODE&gt;
&lt;P&gt;The final result is as shown :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I have attached my pbix file , you can refer to it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Ailsa Tao&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2022 03:14:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-05-12T03:14:45Z</dc:date>
    <item>
      <title>Add new rows to table based on date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2503046#M69241</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to annotations to a graph however in order to make this work with my dynamic date table (month, week, day), I need to add three new rows and two columns to the table below:&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;I want to have a new column called "visual date", a "type" column and three new rows pr date with start date of month, week and date. Should look something like this:&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;I'm unsure how to do this, can anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NicoM96&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 20:26:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2503046#M69241</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-09T20:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add new rows to table based on date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2503547#M69275</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please check the below DAX formula and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new table.&lt;/P&gt;
&lt;P&gt;I suggest having a Dim-Calendar Table like the attached pbix file, that shows ISO year column and ISO weeknumber column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable = 
VAR tableone =
    ADDCOLUMNS ( Data, "@VisualDate", Data[Date], "@Type", "Day" )
VAR tabletwo =
    ADDCOLUMNS (
        Data,
        "@VisualDate",
            VAR _isoyear =
                MAXX (
                    FILTER ( 'Calendar', 'Calendar'[Date] = Data[Date] ),
                    'Calendar'[ISO Year CC]
                )
            VAR _isoweek =
                MAXX (
                    FILTER ( 'Calendar', 'Calendar'[Date] = Data[Date] ),
                    'Calendar'[ISO Week CC]
                )
            RETURN
                MINX (
                    FILTER (
                        'Calendar',
                        'Calendar'[ISO Year CC] = _isoyear
                            &amp;amp;&amp;amp; 'Calendar'[ISO Week CC] = _isoweek
                    ),
                    'Calendar'[Date]
                ),
        "@Type", "Week"
    )
VAR tablethree =
    ADDCOLUMNS (
        Data,
        "@VisualDate", EOMONTH ( Data[Date], -1 ) + 1,
        "@Type", "Month"
    )
RETURN
    UNION ( tableone, tabletwo, tablethree )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 05:54:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2503547#M69275</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-05-10T05:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Add new rows to table based on date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2509202#M69560</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You need to create a table that combine [date] and [type] .&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then merage the Type table and dynamic date table in Query Editor to get a new table .&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then expand the new table and you will get a table like this :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Next you can create a [visual date] column according to [type] column .&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;visual date =
var _week=Merge1[Date]-WEEKDAY(Merge1[Date],2)+1
var _month=EOMONTH(Merge1[Date],-1)+1
return SWITCH(TRUE(),Merge1[Type.Type]="Day",Merge1[Date],Merge1[Type.Type]="Week",_week,Merge1[Type.Type]="Month",_month)&lt;/LI-CODE&gt;
&lt;P&gt;The final result is as shown :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I have attached my pbix file , you can refer to it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Ailsa Tao&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 03:14:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Add-new-rows-to-table-based-on-date/m-p/2509202#M69560</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-12T03:14:45Z</dc:date>
    </item>
  </channel>
</rss>

