<?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 Attempting to determine overlap between date slicer and contract lifespan in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4137922#M164369</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set that includes customer contracts. The contracts have a start and end date. I want to be able to set a slicer with a start and end date. From that sliced date range, I want to determine how many days between the start and end date of the contract fall within the date range.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I have created a date table called DateTable. You can set the date range through a slicer. The problem I encounter is the following: I want to determine the latest date between every row's (and thus contract) start date and the earliest date of the slicer. Similarly, I want to determine the earliest date between the end of the contract and the end of the slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Through a calculated column, I cannot process the date range (as the column is calculated prior to setting the filter). Yet, through a measure I am not able to determine the dates PER row (as every contract has different start and end dates).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clues on how to solve this?&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2024 15:07:23 GMT</pubDate>
    <dc:creator>kvanlavieren</dc:creator>
    <dc:date>2024-09-06T15:07:23Z</dc:date>
    <item>
      <title>Attempting to determine overlap between date slicer and contract lifespan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4137922#M164369</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set that includes customer contracts. The contracts have a start and end date. I want to be able to set a slicer with a start and end date. From that sliced date range, I want to determine how many days between the start and end date of the contract fall within the date range.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I have created a date table called DateTable. You can set the date range through a slicer. The problem I encounter is the following: I want to determine the latest date between every row's (and thus contract) start date and the earliest date of the slicer. Similarly, I want to determine the earliest date between the end of the contract and the end of the slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Through a calculated column, I cannot process the date range (as the column is calculated prior to setting the filter). Yet, through a measure I am not able to determine the dates PER row (as every contract has different start and end dates).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clues on how to solve this?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 15:07:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4137922#M164369</guid>
      <dc:creator>kvanlavieren</dc:creator>
      <dc:date>2024-09-06T15:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to determine overlap between date slicer and contract lifespan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4138347#M164390</link>
      <description>&lt;P&gt;INTERSECT() is your friend. And COUNTROWS() around it, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 20:25:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4138347#M164390</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-09-06T20:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to determine overlap between date slicer and contract lifespan</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4149189#M164870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="802604" data-lia-user-login="kvanlavieren" class="lia-mention lia-mention-user"&gt;kvanlavieren&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created these data.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;You can create these measures.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LatestStartDate = 
VAR SlicerStartDate = MIN('DateTable'[Date])
RETURN
CALCULATE(
    MAX('Contracts'[StartDate]),
    'Contracts'[StartDate] &amp;gt;= SlicerStartDate
)


EarliestEndDate = 
VAR SlicerEndDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
    MIN('Contracts'[EndDate]),
    'Contracts'[EndDate] &amp;lt;= SlicerEndDate
)


DaysWithinRange = 
VAR LatestStart = [LatestStartDate]
VAR EarliestEnd = [EarliestEndDate]
RETURN
IF(
    ISBLANK(LatestStart) || ISBLANK(EarliestEnd),
    0,
    DATEDIFF(LatestStart, EarliestEnd, DAY)
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;The final result is shown below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't want to display data outside of the filtered dates, you can filter for non-blank data in the right filter pane.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 09:09:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Attempting-to-determine-overlap-between-date-slicer-and-contract/m-p/4149189#M164870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-13T09:09:36Z</dc:date>
    </item>
  </channel>
</rss>

