<?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- how to select the respective contract starts and end date from list of customer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2186709#M51007</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260975" data-lia-user-login="v-robertq-msft" class="lia-mention lia-mention-user"&gt;v-robertq-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your suggestion. it is very helpful!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;BR /&gt;Appreciate it.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 06:38:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-11-12T06:38:42Z</dc:date>
    <item>
      <title>DATESBETWEEN- how to select the respective contract starts and end date from list of customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2177468#M50652</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Good day!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am trying to solve two questions below:-&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;I am trying to write a DAX which calculates the total sales between contract start date and 31 Oct 2021 for respective customer. Each of the customers has own different contract start date in data table. May I know what DAX I should use in the "start date" below since it requires an expression?&lt;BR /&gt;&lt;BR /&gt;Contract start to current month = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Total Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, [Start Date], date(2021,10,31)))&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;If I want to import the 'end date' above from excel file whereby i would change the end date whenever i want in excel (consists of just one column and one value in one cell) and subsequently refresh the PBI, rather than going into PBI to edit the formula, what DAX should i use to replace the hardcoding "2021,10,31' above?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 10 Nov 2021 08:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2177468#M50652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-10T08:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN- how to select the respective contract starts and end date from list of customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2177812#M50664</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , Try a measure like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;sales =&lt;BR /&gt;var _max1 = maxx(allselected('Date'),'Date'[Date])&lt;BR /&gt;var _min1 = minx(allselected('Date'),'Date'[Date])&lt;BR /&gt;var _max2 = minx(allselected('Sales'),'Sales'[Contract Start])&lt;BR /&gt;var _min2 = maxx(allselected('Sales'),'Sales'[Contract End])&lt;BR /&gt;var _min = max(_min1, _max2) &lt;BR /&gt;var _max = min(_max1,_min2)&lt;BR /&gt;return&lt;BR /&gt;calculate(sumx(values(Sales[customer]),[Total Sales]), filter('Date','Date'[Date] &amp;gt;=Min &amp;amp;&amp;amp; 'Date'[Date]&amp;lt;=_max))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or check if these can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Nov 2021 10:42:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2177812#M50664</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-11-08T10:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN- how to select the respective contract starts and end date from list of customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2179586#M50697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your advise. Unfortunately I am very new to Power BI and I couldn't really understand the logic of the measures you suggested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have two sets of data. First is the sales table in the past 2 years and second is the contract details for each customer as shown below. I would like to calculate the sales from the start date of contract up to 31 Oct 2021 for each customer. Can I use the Datesbetween function? If so, what expresison should I use to replace the "Start Date" in the formula below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Contract start to current month =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Total Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;FONT face="arial black,avant garde"&gt;&lt;EM&gt;&lt;U&gt;&lt;STRONG&gt;[Start Date]&lt;/STRONG&gt;&lt;/U&gt;&lt;/EM&gt;&lt;/FONT&gt;, date(2021,10,31)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can i actually replace it with Max('Contract details' [Contract Start]), since it only has one start date for each customer?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 05:18:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2179586#M50697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-09T05:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN- how to select the respective contract starts and end date from list of customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2182474#M50819</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, I can roughly understand your requirement, I　think　you　can　use　the　Filter()　function　to　simply　achieve　your　needs,　 you can try these measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Contract Start =

CALCULATE(MIN('Contract details'[Contract Date]),FILTER(ALL('Contract details'),[Customer]=MAX('Contract details'[Customer])))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Sales from Contract Start =

CALCULATE(SUM('Contract details'[Sales amount]),FILTER(ALL('Contract details'),[Contract Date]&amp;gt;=[Contract Start]&amp;amp;&amp;amp;[Contract Date]&amp;lt;=DATE(2021,12,31)&amp;amp;&amp;amp;[Customer]=MAX('Contract details'[Customer])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you can　 place　them　into　ａ　table　chart　to get what you want,　like　this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can download my test pbix file below&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Robert Qin&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 09:49:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2182474#M50819</guid>
      <dc:creator>v-robertq-msft</dc:creator>
      <dc:date>2021-11-10T09:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: DATESBETWEEN- how to select the respective contract starts and end date from list of customer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2186709#M51007</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260975" data-lia-user-login="v-robertq-msft" class="lia-mention lia-mention-user"&gt;v-robertq-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your suggestion. it is very helpful!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;BR /&gt;Appreciate it.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 06:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATESBETWEEN-how-to-select-the-respective-contract-starts-and/m-p/2186709#M51007</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-11-12T06:38:42Z</dc:date>
    </item>
  </channel>
</rss>

