<?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: DATESBETWEEN with two tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912580#M8757</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100650" data-lia-user-login="JonV" class="lia-mention lia-mention-user"&gt;JonV&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is the relationship between the fact and date is defined?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample DAX that works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]&amp;gt;='Fact'[Start] &amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;='Fact'[End]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2 is date(Holiday is a column with value 1 as holiday and 0 is a non holiday)&lt;/P&gt;&lt;P&gt;Fact is your fact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helps, mark it as a solution&lt;/P&gt;&lt;P&gt;Kudos are nice too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2020 15:33:32 GMT</pubDate>
    <dc:creator>VasTg</dc:creator>
    <dc:date>2020-01-27T15:33:32Z</dc:date>
    <item>
      <title>DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912537#M8756</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a fact table that has start and end dates for a process. My goal is to create a calculated column in that fact table to determine the number of days in that period that were holidays.&lt;/P&gt;&lt;P&gt;Separately, I have a dim date table that has a column to denote whether a given date is a holiday or not.&lt;/P&gt;&lt;P&gt;What I thought I'd be able to do is use something along the lines of&amp;nbsp;&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;=COUNTROWS(
    CALCULATETABLE(
        DATESBETWEEN(
            'Date Table'[Dates], 'Fact Table'[Start Date], 'Fact Table'[End Date]), 
        'Date Table'[IsHoliday?] = TRUE
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I'm running into is the DATESBETWEEN function won't accept values from the Fact Table. The relationship between the two tables is defined in the model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on why this isn't working or a better approach?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 15:18:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912537#M8756</guid>
      <dc:creator>JonV</dc:creator>
      <dc:date>2020-01-27T15:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912580#M8757</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100650" data-lia-user-login="JonV" class="lia-mention lia-mention-user"&gt;JonV&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How is the relationship between the fact and date is defined?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample DAX that works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]&amp;gt;='Fact'[Start] &amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;='Fact'[End]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2 is date(Holiday is a column with value 1 as holiday and 0 is a non holiday)&lt;/P&gt;&lt;P&gt;Fact is your fact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helps, mark it as a solution&lt;/P&gt;&lt;P&gt;Kudos are nice too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 15:33:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912580#M8757</guid>
      <dc:creator>VasTg</dc:creator>
      <dc:date>2020-01-27T15:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912603#M8759</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="182681" data-lia-user-login="VasTg" class="lia-mention lia-mention-user"&gt;VasTg&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;How is the relationship between the fact and date is defined?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It is a one-to-many relationship between the date from the date table to the start date in the fact table.&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="182681" data-lia-user-login="VasTg" class="lia-mention lia-mention-user"&gt;VasTg&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Here is the sample DAX that works for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]&amp;gt;='Fact'[Start] &amp;amp;&amp;amp;'Table 2'[Date]&amp;lt;='Fact'[End]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This did not work for me either as DAX is not allowing my to compare the dates from the Fact table to the Date table, I suspect for the same reason as I'm not able to use the functions I intended to.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 15:57:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912603#M8759</guid>
      <dc:creator>JonV</dc:creator>
      <dc:date>2020-01-27T15:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912615#M8760</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100650" data-lia-user-login="JonV" class="lia-mention lia-mention-user"&gt;JonV&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try variables to get the start and end date from fact.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attach your mockup pbix to troubleshoot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helps, mark it as a solution&lt;/P&gt;&lt;P&gt;Kudos are nice too&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 16:06:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912615#M8760</guid>
      <dc:creator>VasTg</dc:creator>
      <dc:date>2020-01-27T16:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912675#M8762</link>
      <description>&lt;P&gt;&lt;A href="https://drive.google.com/open?id=1DNLrb0izbqPaYeqdImNtBwIlgny2cL81" target="_self"&gt;Here is a link to a sample pbix&lt;/A&gt;. Please let me know if that works.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 16:48:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912675#M8762</guid>
      <dc:creator>JonV</dc:creator>
      <dc:date>2020-01-27T16:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN with two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912771#M8766</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="182681" data-lia-user-login="VasTg" class="lia-mention lia-mention-user"&gt;VasTg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get your formula to work with a bit of modification:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Holidays in Period = 
CALCULATE(
    SUM('Date Table'[IsHoliday]),
    FILTER('Date Table',
        'Date Table'[FullDate] &amp;gt;='Fact Table'[Start Date] 
        &amp;amp;&amp;amp; 'Date Table'[FullDate] &amp;lt;= 'Fact Table'[End Date]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 18:26:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-with-two-tables/m-p/912771#M8766</guid>
      <dc:creator>JonV</dc:creator>
      <dc:date>2020-01-27T18:26:56Z</dc:date>
    </item>
  </channel>
</rss>

