<?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: Store filter criteria as a string in a variable so I don't have to keep typing it in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085002#M162136</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="14193" data-lia-user-login="RMDNA" class="lia-mention lia-mention-user"&gt;RMDNA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EVALUTE
var filter_criteria= filter(table,Category1 = "Value'&amp;amp;&amp;amp; Category2 = "Value2" &amp;amp;&amp;amp; category3="Value3"&amp;amp;&amp;amp;....)
return
CALCULATE(COUNTROWS(Table),filter_criteria)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Dangar&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2024 19:35:53 GMT</pubDate>
    <dc:creator>Dangar332</dc:creator>
    <dc:date>2024-08-06T19:35:53Z</dc:date>
    <item>
      <title>Store filter criteria as a string in a variable so I don't have to keep typing it</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4084984#M162135</link>
      <description>&lt;P&gt;Hi all, hopefully quick question here. I'm writing some simple statements in DAX Studio like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(COUNTROWS(Table),Category1 = "Value',Category2 = "Value2") = 100&lt;/LI-CODE&gt;&lt;P&gt;This works fine, but I don't want to keep typing my filters (Cat1=, Cat2=,etc.) over and over again. Can I somehow capture that into a string and just use that in my post-calculate filter statements? I'd like to set up a bunch of filters at the start of the statement and just reference them throughout the rest of the script. E.g.:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR filter_criteria = (Category1 = "Value',Category2 = "Value2")
EVALUTE
CALCULATE(COUNTROWS(Table),filter_criteria) = 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Or am I missing an easier solution?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 19:16:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4084984#M162135</guid>
      <dc:creator>RMDNA</dc:creator>
      <dc:date>2024-08-06T19:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Store filter criteria as a string in a variable so I don't have to keep typing it</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085002#M162136</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="14193" data-lia-user-login="RMDNA" class="lia-mention lia-mention-user"&gt;RMDNA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EVALUTE
var filter_criteria= filter(table,Category1 = "Value'&amp;amp;&amp;amp; Category2 = "Value2" &amp;amp;&amp;amp; category3="Value3"&amp;amp;&amp;amp;....)
return
CALCULATE(COUNTROWS(Table),filter_criteria)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Dangar&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 19:35:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085002#M162136</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-08-06T19:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Store filter criteria as a string in a variable so I don't have to keep typing it</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085039#M162137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569583" data-lia-user-login="Dangar332" class="lia-mention lia-mention-user"&gt;Dangar332&lt;/a&gt;&amp;nbsp;- what if I wanted to filter on multiple tables? E.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(Table1[Field1] = x, Table2[Field2] = y || Table2[Field2] = z)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since they included filtering as a native ability of Calculate, I've stopped using the actual Filter function for a long time. I believe it can only accept a single table as a reference. Do I need to nest Filters? Seems inefficient.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 20:20:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085039#M162137</guid>
      <dc:creator>RMDNA</dc:creator>
      <dc:date>2024-08-06T20:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Store filter criteria as a string in a variable so I don't have to keep typing it</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085167#M162141</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="14193" data-lia-user-login="RMDNA" class="lia-mention lia-mention-user"&gt;RMDNA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can use Crossjoin ()&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;filter(
crossjoin(
values(Table1[Field1]),
values( Table2[Field2])
),
Table1[Field1] = x &amp;amp;&amp;amp; Table2[Field2] = y)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Dangar&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 21:09:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Store-filter-criteria-as-a-string-in-a-variable-so-I-don-t-have/m-p/4085167#M162141</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2024-08-06T21:09:58Z</dc:date>
    </item>
  </channel>
</rss>

