<?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: How to add rows with missing dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4600068#M176098</link>
    <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;You can follow below M code as well&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XcjJCcAwDATAXvZthUXO+qhFqP82EtAjxDCviYAvo5vThQZe0hSyBdjt9f3gqr//r9nrdX71OHpvZD4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date from original report" = _t, ExRate = _t]),
    #"Added Index" = Table.AddIndexColumn(Source, "FirstIndex", 1
, 1, Int64.Type),
    #"Added Index1" = Table.AddIndexColumn(#"Added Index", "SecondIndex", 0, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index1", {"FirstIndex"}, #"Added Index1", {"SecondIndex"}, "Added Index1", JoinKind.LeftOuter),
    #"Expanded Added Index1" = Table.ExpandTableColumn(#"Merged Queries", "Added Index1", {"Date from original report"}, {"EndDate"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Added Index1",{{"SecondIndex", Order.Ascending}}),
    #"Filled Down" = Table.FillDown(#"Sorted Rows",{"EndDate"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Filled Down",{{"EndDate", type date},{"Date from original report",type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "ListOfDate", each List.Dates(
    [Date from original report],
Number.From([EndDate] ) - Number.From( [Date from original report] ) ,
#duration(1,0,0,0)
)),
    #"Expanded ListOfDate" = Table.ExpandListColumn(#"Added Custom", "ListOfDate"),
    #"Added Conditional Column" = Table.AddColumn(#"Expanded ListOfDate", "OriginalDate", each if [ListOfDate] = null then [Date from original report] else [ListOfDate]),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Conditional Column",{"ExRate", "OriginalDate"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Other Columns",{"OriginalDate", "ExRate"})
in
    #"Reordered Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below screenshot&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Hope it will help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;sanalytics&lt;/P&gt;</description>
    <pubDate>Fri, 07 Mar 2025 09:21:25 GMT</pubDate>
    <dc:creator>sanalytics</dc:creator>
    <dc:date>2025-03-07T09:21:25Z</dc:date>
    <item>
      <title>How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4598686#M176057</link>
      <description>&lt;P&gt;Hello everyone.&lt;BR /&gt;Need help with a table. There is a table with exchange rates.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1: How to add rows between missing dates&lt;BR /&gt;For example, I need to add dates between 28/02/2025 and 03/03/2025, data for 28/02/2025 should be for missing dates. see the picture&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 2: How to shift data one forward?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:04:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4598686#M176057</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-06T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4598698#M176059</link>
      <description>&lt;P&gt;Screenshot of the table for the second question&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4598698#M176059</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-06T14:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4599645#M176084</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After loading the table in the Power Query editor and adding a new query, use the following M code to reference the source table to create a new table that meets the requirements.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
  StartDate = List.Min(Table[Date from original report]),
  EndDate = List.Max(Table[Date from original report]),
  DateList = List.Dates(StartDate, Duration.Days(EndDate - StartDate) + 1, #duration(1, 0, 0, 0)),
  DateTable = Table.TransformColumnTypes(
    Table.FromList(
      DateList,
      Splitter.SplitByNothing(),
      {"Date from original report"},
      null,
      ExtraValues.Error
    ),
    {{"Date from original report", type date}}
  ),
  #"Merged Queries" = Table.NestedJoin(
    DateTable,
    {"Date from original report"},
    Table,
    {"Date from original report"},
    "Table",
    JoinKind.LeftOuter
  ),
  #"Expanded Table" = Table.Sort(
    Table.ExpandTableColumn(#"Merged Queries", "Table", {"ExRate"}, {"ExRate"}),
    {{"Date from original report", Order.Ascending}}
  ),
  #"Filled Down" = Table.FillDown(#"Expanded Table", {"ExRate"}),
  #"Added Custom" = Table.AddColumn(
    #"Filled Down",
    "Date from final report",
    each [Date from original report] + #duration(1, 0, 0, 0)
  ),
  #"Changed Type" = Table.TransformColumnTypes(
    #"Added Custom",
    {{"Date from final report", type date}}
  ),
  #"Reordered Columns" = Table.ReorderColumns(
    #"Changed Type",
    {"Date from original report", "Date from final report", "ExRate"}
  )
in
  #"Reordered Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="tinyMceEditor_3a2281ebcbba57vdengllimsft_4" class=""&gt;&lt;SPAN&gt;The approximate steps are as follows:&lt;/SPAN&gt;
&lt;P&gt;First generate a date table containing the desired date range.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;Then merge the date table with the source data table using the left join.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select the 'ExRate' column and use the fill down.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add a custom column that shows the date moved forward one day.&lt;/P&gt;
&lt;P&gt;&lt;img /&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;Please see the attached pbix for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Dengliang Li&lt;BR /&gt;&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>Fri, 07 Mar 2025 03:08:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4599645#M176084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-07T03:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4600068#M176098</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;You can follow below M code as well&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("XcjJCcAwDATAXvZthUXO+qhFqP82EtAjxDCviYAvo5vThQZe0hSyBdjt9f3gqr//r9nrdX71OHpvZD4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date from original report" = _t, ExRate = _t]),
    #"Added Index" = Table.AddIndexColumn(Source, "FirstIndex", 1
, 1, Int64.Type),
    #"Added Index1" = Table.AddIndexColumn(#"Added Index", "SecondIndex", 0, 1, Int64.Type),
    #"Merged Queries" = Table.NestedJoin(#"Added Index1", {"FirstIndex"}, #"Added Index1", {"SecondIndex"}, "Added Index1", JoinKind.LeftOuter),
    #"Expanded Added Index1" = Table.ExpandTableColumn(#"Merged Queries", "Added Index1", {"Date from original report"}, {"EndDate"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Added Index1",{{"SecondIndex", Order.Ascending}}),
    #"Filled Down" = Table.FillDown(#"Sorted Rows",{"EndDate"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Filled Down",{{"EndDate", type date},{"Date from original report",type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "ListOfDate", each List.Dates(
    [Date from original report],
Number.From([EndDate] ) - Number.From( [Date from original report] ) ,
#duration(1,0,0,0)
)),
    #"Expanded ListOfDate" = Table.ExpandListColumn(#"Added Custom", "ListOfDate"),
    #"Added Conditional Column" = Table.AddColumn(#"Expanded ListOfDate", "OriginalDate", each if [ListOfDate] = null then [Date from original report] else [ListOfDate]),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Conditional Column",{"ExRate", "OriginalDate"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Other Columns",{"OriginalDate", "ExRate"})
in
    #"Reordered Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below screenshot&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Hope it will help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;sanalytics&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 09:21:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4600068#M176098</guid>
      <dc:creator>sanalytics</dc:creator>
      <dc:date>2025-03-07T09:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4604848#M176280</link>
      <description>&lt;P&gt;Thank you a lot, it's working&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 09:45:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4604848#M176280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-11T09:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to add rows with missing dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4604850#M176281</link>
      <description>&lt;P&gt;Thanks for your help, I haven't tried your method, I used the previous one, but I'm sure yours works too&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 09:46:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-rows-with-missing-dates/m-p/4604850#M176281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-03-11T09:46:59Z</dc:date>
    </item>
  </channel>
</rss>

