<?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() with measure as a date filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/794139#M4637</link>
    <description>&lt;P&gt;As requested by few people, the code should look like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New_measure =&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;variable&lt;/STRONG&gt;=[last_date] #last_date is a measure&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;CALCULATE(AVERAGE(Table1[volume];Table1[date]=&lt;STRONG&gt;variable&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;last_date=&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CALCULATE(LASTDATE(Table1[date]);&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;#find the last date available in table1&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;DATESINPERIOD('CALENDAR'[Date];LASTDATE('CALENDAR'[Date]);-7;DAY))&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;#define the range of dates&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="136141" data-lia-user-login="SingSong" class="lia-mention lia-mention-user"&gt;SingSong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2019 07:50:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-09-17T07:50:39Z</dc:date>
    <item>
      <title>CALCULATE() with measure as a date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/790850#M4517</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using a measure to find the last date of a row in table (table1) already&amp;nbsp;filtered by a date segment. Looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Last _date =&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;CALCULATE(LASTDATE(Table1[date]);&amp;nbsp;&lt;/STRONG&gt; &amp;nbsp; &lt;EM&gt;#find the last date available in table1&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;DATESINPERIOD('CALENDAR'[Date];LASTDATE('CALENDAR'[Date]);-7;DAY))&lt;/STRONG&gt;&amp;nbsp; &lt;EM&gt;#define the range of dates&amp;nbsp;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Until here I know&amp;nbsp;it's working properly because when I visualize the data I have the last date for all my items.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Item1 | Last_date_1&lt;/DIV&gt;&lt;DIV&gt;Item2 | Last_date_2&lt;/DIV&gt;&lt;DIV&gt;Item2 | Last_date_2&lt;/DIV&gt;&lt;DIV&gt;....&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now I want to add a an other measure to this visual. This is were I'm lost.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would like to use my &lt;STRONG&gt;last_date&lt;/STRONG&gt; measure as a date filter in a new &lt;STRONG&gt;CALCULATE()&lt;/STRONG&gt; function.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Something like this but it's not working saying that a CALCULATE function has been used in a filter..&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Volume_measure=&lt;STRONG&gt;CALCULATE(SUM(Table1[Volume]);Table1[date]=[Last_date])&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any idea, trick?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:54:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/790850#M4517</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-12T15:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE() with measure as a date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/790905#M4518</link>
      <description>&lt;P&gt;Problem solved with VAR&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 16:36:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/790905#M4518</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-12T16:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE() with measure as a date filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/794139#M4637</link>
      <description>&lt;P&gt;As requested by few people, the code should look like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New_measure =&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;variable&lt;/STRONG&gt;=[last_date] #last_date is a measure&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;CALCULATE(AVERAGE(Table1[volume];Table1[date]=&lt;STRONG&gt;variable&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;last_date=&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CALCULATE(LASTDATE(Table1[date]);&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;#find the last date available in table1&lt;/EM&gt;&lt;BR /&gt;&lt;STRONG&gt;DATESINPERIOD('CALENDAR'[Date];LASTDATE('CALENDAR'[Date]);-7;DAY))&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;#define the range of dates&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="136141" data-lia-user-login="SingSong" class="lia-mention lia-mention-user"&gt;SingSong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 07:50:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-with-measure-as-a-date-filter/m-p/794139#M4637</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-17T07:50:39Z</dc:date>
    </item>
  </channel>
</rss>

