<?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 Using measures in filter expression in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2482555#M68019</link>
    <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to PowerBi and currently wondering about how the filter in CALCULATE works.&lt;/P&gt;&lt;P&gt;I have a column "ColumnA" which is part of "Table1" that should be filtered and returned. Therefore, I calculate a new measure with the following expression:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;newmeasure = CALCULATE(Table1[ColumnA], 'Table1'[Category] IN { "A" }, 'Table1'[Quarter] IN { 202202 })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works fine and I'm happy with the result. However, as the quarter changes with time, I do not want to provide a fixed value but use another measure for filtering. And so I replaced the above expression with:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;newmeasure = CALCULATE(Table1[ColumnA], 'Table1'[Category] IN { "A" }, 'Table1'[Quarter] IN {VALUE('Table2'[cur_quarter]) })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The measure "cur_quarter" is part of "Table2" and contains the current quarter as string. The new expression fails with the error message "A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression.". From what I understand is that CALCULATE does not support measures or columns in the filter section, but to me it seems like an easy task and I see no reason why it does not work (it would work in any programming language). So far I did not find a realization that works, also trying other functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can this be implemented? Do you have an idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm happy to hear your suggestions. Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Apr 2022 08:29:00 GMT</pubDate>
    <dc:creator>ftf</dc:creator>
    <dc:date>2022-04-28T08:29:00Z</dc:date>
    <item>
      <title>Using measures in filter expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2482555#M68019</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to PowerBi and currently wondering about how the filter in CALCULATE works.&lt;/P&gt;&lt;P&gt;I have a column "ColumnA" which is part of "Table1" that should be filtered and returned. Therefore, I calculate a new measure with the following expression:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;newmeasure = CALCULATE(Table1[ColumnA], 'Table1'[Category] IN { "A" }, 'Table1'[Quarter] IN { 202202 })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This works fine and I'm happy with the result. However, as the quarter changes with time, I do not want to provide a fixed value but use another measure for filtering. And so I replaced the above expression with:&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;newmeasure = CALCULATE(Table1[ColumnA], 'Table1'[Category] IN { "A" }, 'Table1'[Quarter] IN {VALUE('Table2'[cur_quarter]) })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The measure "cur_quarter" is part of "Table2" and contains the current quarter as string. The new expression fails with the error message "A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression.". From what I understand is that CALCULATE does not support measures or columns in the filter section, but to me it seems like an easy task and I see no reason why it does not work (it would work in any programming language). So far I did not find a realization that works, also trying other functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can this be implemented? Do you have an idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm happy to hear your suggestions. Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 08:29:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2482555#M68019</guid>
      <dc:creator>ftf</dc:creator>
      <dc:date>2022-04-28T08:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using measures in filter expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2483020#M68050</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="381204" data-lia-user-login="ftf" class="lia-mention lia-mention-user"&gt;ftf&lt;/a&gt; , QTD/Qtr based on selected date or today &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QTD = &lt;BR /&gt;var _max = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())&lt;BR /&gt;var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,Month(_max)))+1,&lt;BR /&gt;return&lt;BR /&gt;CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Apr 2022 11:05:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2483020#M68050</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-04-28T11:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using measures in filter expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2490345#M68545</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="381204" data-lia-user-login="ftf" class="lia-mention lia-mention-user"&gt;ftf&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just the error said, you have used a TRUE/FALSE expression as a table filter expression. This is not allowed. You could refer to this official doc to learn what kind of filters can be used as the parameters of CALCULATE function: &lt;A href="https://docs.microsoft.com/en-us/dax/calculate-function-dax#parameters" target="_blank"&gt;CALCULATE function (DAX) - DAX | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, you need make some changes to your Measure formula.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CalculationOnFilters =
CALCULATE (
    SUM ( Table1[ColumnA] ),
    FILTER (
        Table1,
        'Table1'[Category]
            IN { "A" }
                &amp;amp;&amp;amp; 'Table1'[Quarter] IN { VALUE ( 'Table2'[current_quarter] ) }
    )
)
//CALCULATE(SUM(Table1[ColumnA]),'Table1'[Category] IN { "A" },'Table1'[Quarter] IN {VALUE('Table2'[current_quarter]) })

&lt;/LI-CODE&gt;
&lt;P&gt;With the sample data created, the result looks 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;Also, attach the pbix file as reference. Hope it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!&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 _ Caiyun&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 08:05:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2490345#M68545</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2022-05-03T08:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using measures in filter expression</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2493391#M68727</link>
      <description>&lt;P&gt;Thanks for your help, &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="277465" data-lia-user-login="v-cazheng-msft" class="lia-mention lia-mention-user"&gt;v-cazheng-msft&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 12:33:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-measures-in-filter-expression/m-p/2493391#M68727</guid>
      <dc:creator>ftf</dc:creator>
      <dc:date>2022-05-04T12:33:41Z</dc:date>
    </item>
  </channel>
</rss>

