<?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: How to create dynamic filter in DAX query in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4363366#M173232</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thank you for the inputs. As I want to add multiple filters dynamically, I chose the following route:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EVALUATE&lt;BR /&gt;FILTER(MyTable,&lt;BR /&gt;AND(MyTable[col1]=@Col1Value , IF(NOT(ISBLANK(@Col2Value)), MyTable[col2]=@qCol2Value, TRUE().....))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will also try your syntax.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2025 13:42:18 GMT</pubDate>
    <dc:creator>bhavya11</dc:creator>
    <dc:date>2025-01-14T13:42:18Z</dc:date>
    <item>
      <title>How to create dynamic filter in DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4362056#M173181</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to dynamically filter my data in PBI Report Builder using DAX expression. The columns in the filter will be added dynamically based on what the user selects in the report.&lt;/P&gt;&lt;P&gt;It is a embedded paginated report with a PBI Semantic model as it's dataset. The PBI Semantic Model dataset is created using DirectQuery.&lt;/P&gt;&lt;P&gt;I am sharing the semantic model between PBI Report and Paginated Report. Paginated Report is required to export the tabular report data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following DAX :&lt;/P&gt;&lt;P&gt;DEFINE&lt;BR /&gt;VAR filters = IF(NOT(ISBLANK(@param1)), "MyTable[col1]=" &amp;amp; @param1, BLANK())&lt;/P&gt;&lt;P&gt;EVALUATE&lt;BR /&gt;FILTER(MyTable, filters)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;The query contains the 'param1' parameter, which is not declared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that I have created a Query Parameter named param1 in the DataSet properties and associated it with respectvie report parameter. The report parameters are passed to the report in the payload.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 19:24:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4362056#M173181</guid>
      <dc:creator>bhavya11</dc:creator>
      <dc:date>2025-01-13T19:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic filter in DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4362583#M173199</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="909132" data-lia-user-login="bhavya11" class="lia-mention lia-mention-user"&gt;bhavya11&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"MyTable[col1]=" &amp;amp; @param1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This part looks like text, and the second argument to filter needs to be a boolean expression.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/filter-function-dax" target="_blank" rel="noopener"&gt;FILTER function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DEFINE
    VAR param1Value = @param1
    VAR filters =
        IF (
            NOT ISBLANK ( param1Value ),
            FILTER ( MyTable, MyTable[col1] = param1Value ),
            MyTable
        )

EVALUATE
filters&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener nofollow noreferrer"&gt;How to get your questions answered quickly&lt;/A&gt;&amp;nbsp;--&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 06:40:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4362583#M173199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-01-14T06:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic filter in DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4363366#M173232</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thank you for the inputs. As I want to add multiple filters dynamically, I chose the following route:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EVALUATE&lt;BR /&gt;FILTER(MyTable,&lt;BR /&gt;AND(MyTable[col1]=@Col1Value , IF(NOT(ISBLANK(@Col2Value)), MyTable[col2]=@qCol2Value, TRUE().....))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will also try your syntax.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 13:42:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4363366#M173232</guid>
      <dc:creator>bhavya11</dc:creator>
      <dc:date>2025-01-14T13:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic filter in DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4364794#M173279</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;This one doesn't work. I get the same error&amp;nbsp;@param1 is not defined.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 09:46:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-create-dynamic-filter-in-DAX-query/m-p/4364794#M173279</guid>
      <dc:creator>bhavya11</dc:creator>
      <dc:date>2025-01-15T09:46:09Z</dc:date>
    </item>
  </channel>
</rss>

