<?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: Calculate if selected date is between two dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-if-selected-date-is-between-two-dates/m-p/2571732#M73469</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please use&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=
VAR MaxDate =
    MAX ( 'Calendar'[Date] )
VAR MinDate =
    MIN ( 'Calendar'[Date] )
RETURN
    SUMX (
        TableName,
        IF ( TableName[StartDate] &amp;lt;= MaxDate &amp;amp;&amp;amp; TableName[EndDate] &amp;gt;= MinDate, 1 )
    )&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 10 Jun 2022 12:43:24 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-06-10T12:43:24Z</dc:date>
    <item>
      <title>Calculate if selected date is between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-if-selected-date-is-between-two-dates/m-p/2571555#M73461</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am struggling with a difficult problem. I have a fact table with 2 dates: Task Start Date and Task End Date. I have another dimension table (calendar table) with 2 inactive relationships between these 2 dates and calendar date. In calendar table I have information about Year and month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to calculate it in dax? I have tried with something using selectedvalue(calendar[year]), selectedvalue(calendar[month]) and combine it with these 2 dates, but it is incorrect. 1 should be inserted if calendar Year and calendar Month match to Year and Month these 2 dates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 11:21:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-if-selected-date-is-between-two-dates/m-p/2571555#M73461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-10T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate if selected date is between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-if-selected-date-is-between-two-dates/m-p/2571732#M73469</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please use&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=
VAR MaxDate =
    MAX ( 'Calendar'[Date] )
VAR MinDate =
    MIN ( 'Calendar'[Date] )
RETURN
    SUMX (
        TableName,
        IF ( TableName[StartDate] &amp;lt;= MaxDate &amp;amp;&amp;amp; TableName[EndDate] &amp;gt;= MinDate, 1 )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Jun 2022 12:43:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-if-selected-date-is-between-two-dates/m-p/2571732#M73469</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-10T12:43:24Z</dc:date>
    </item>
  </channel>
</rss>

