<?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 Help converting list of items with date range into (with gaps in date range) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859677#M39836</link>
    <description>&lt;P&gt;Hey.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently using the suggested conversion column conversion as suggested here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Help-converting-list-of-items-with-date-range-into-a-table-for/m-p/1621431#M653628" target="_blank" rel="noopener"&gt;Solved: Help converting list of items with date range into... - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now need to exclude some gaps within the date range but am unsure how to achieve this using the custom field formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table Source Data Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Item&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Start Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;End Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 1 Start&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 1 End&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STR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lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using:&lt;/P&gt;&lt;PRE&gt;{Number.From([Start Date])..Number.From([End Date])}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to achieve the same but with the dates that fall between&amp;nbsp;Gap 1 Start and&amp;nbsp;Gap 1 End, and also&amp;nbsp;Gap 2 Start and Gap 2 End Where they exist. Where they don't exist then the original formula is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help kindly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nigel&lt;/P&gt;</description>
    <pubDate>Mon, 24 May 2021 08:25:34 GMT</pubDate>
    <dc:creator>Coltella8013</dc:creator>
    <dc:date>2021-05-24T08:25:34Z</dc:date>
    <item>
      <title>Help converting list of items with date range into (with gaps in date range)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859677#M39836</link>
      <description>&lt;P&gt;Hey.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently using the suggested conversion column conversion as suggested here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Help-converting-list-of-items-with-date-range-into-a-table-for/m-p/1621431#M653628" target="_blank" rel="noopener"&gt;Solved: Help converting list of items with date range into... - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now need to exclude some gaps within the date range but am unsure how to achieve this using the custom field formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table Source Data Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Item&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Start Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;End Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 1 Start&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 1 End&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 2 Start&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Gap 2 End&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 1&lt;/TD&gt;&lt;TD&gt;Type 1&lt;/TD&gt;&lt;TD&gt;01/01/2021&lt;/TD&gt;&lt;TD&gt;10/01/2021&lt;/TD&gt;&lt;TD&gt;03/01/2021&lt;/TD&gt;&lt;TD&gt;04/01/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 2&lt;/TD&gt;&lt;TD&gt;Type 2&lt;/TD&gt;&lt;TD&gt;03/01/2021&lt;/TD&gt;&lt;TD&gt;10/01/2021&lt;/TD&gt;&lt;TD&gt;04/01/2021&lt;/TD&gt;&lt;TD&gt;05/01/2021&lt;/TD&gt;&lt;TD&gt;08/01/2021&lt;/TD&gt;&lt;TD&gt;09/01/2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 3&lt;/TD&gt;&lt;TD&gt;Type 1&lt;/TD&gt;&lt;TD&gt;05/01/2021&lt;/TD&gt;&lt;TD&gt;10/01/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Item 4&lt;/TD&gt;&lt;TD&gt;Type 1&lt;/TD&gt;&lt;TD&gt;07/01/2021&lt;/TD&gt;&lt;TD&gt;08/01/2021&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using:&lt;/P&gt;&lt;PRE&gt;{Number.From([Start Date])..Number.From([End Date])}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to achieve the same but with the dates that fall between&amp;nbsp;Gap 1 Start and&amp;nbsp;Gap 1 End, and also&amp;nbsp;Gap 2 Start and Gap 2 End Where they exist. Where they don't exist then the original formula is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help kindly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nigel&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 08:25:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859677#M39836</guid>
      <dc:creator>Coltella8013</dc:creator>
      <dc:date>2021-05-24T08:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help converting list of items with date range into (with gaps in date range)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859711#M39837</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="281972" data-lia-user-login="Coltella8013" class="lia-mention lia-mention-user"&gt;Coltella8013&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the expected output for the sample data you are showing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 08:37:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859711#M39837</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2021-05-24T08:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help converting list of items with date range into (with gaps in date range)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859816#M39839</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be similar to this but without the dates that fall between the GAP fields (excluding the last date in the range). Notice the strike through's below that were the dates from the Gap date ranges.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 09:08:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1859816#M39839</guid>
      <dc:creator>Coltella8013</dc:creator>
      <dc:date>2021-05-24T09:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help converting list of items with date range into (with gaps in date range)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1860932#M39868</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="281972" data-lia-user-login="Coltella8013" class="lia-mention lia-mention-user"&gt;Coltella8013&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Place the following M code in a blank query to see the steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8ixJzVUwVNJRCqksSAUzDAz1gcjIwAjEMTRA4hgYI3NMkDgKYByrAzXPCGaeEbouVPOQjTAwReZYIHMs4Ry4DcYoLjbFZYMCCobrNkHRbY7LYpAuKIqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Type = _t, #"Start Date" = _t, #"End Date" = _t, #"Gap 1 Start" = _t, #"Gap 1 End" = _t, #"Gap 2 Start" = _t, #"Gap 2 End" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Item", type text}, {"Type", type text}, {"Start Date", type date}, {"End Date", type date}, {"Gap 1 Start", type date}, {"Gap 1 End", type date}, {"Gap 2 Start", type date}, {"Gap 2 End", type date}}),

    #"Added Custom" = Table.AddColumn(#"Changed Type", "Total", each let total_ = {Number.From([Start Date])..Number.From([End Date])},
        gap1_ = try {Number.From([Gap 1 Start])..Number.From([Gap 1 End])} otherwise {},
        gap2_ = try {Number.From([Gap 2 Start])..Number.From([Gap 2 End])} otherwise {},
        gaps_ = gap1_ &amp;amp; gap2_,
        res_ = List.Select(total_,each not List.Contains(gaps_, _)) 
        in res_),
    #"Expanded Total" = Table.ExpandListColumn(#"Added Custom", "Total"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Total",{{"Total", type date}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Start Date", "End Date", "Gap 1 Start", "Gap 1 End", "Gap 2 Start", "Gap 2 End"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Total", "Item", "Type"})
in
    #"Reordered Columns"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 100px; width: 100%; border-collapse: collapse; border-style: groove; border-color: #0c1c49; background-color: #00675f;" border="0" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15px;"&gt;
&lt;TD width="15.961305925030231%" style="width: 92px; height: 15px;"&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="84.03869407496977%" style="width: 485px; height: 15px; text-align: left;"&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Please accept the solution when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#FFFFFF"&gt;&lt;SPAN style="color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4.5" color="#FF99CC"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 19:46:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-converting-list-of-items-with-date-range-into-with-gaps-in/m-p/1860932#M39868</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2021-05-24T19:46:44Z</dc:date>
    </item>
  </channel>
</rss>

