<?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 How Filtering by multiple typeValue for the same Type in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3913822#M34883</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;So this is my problem.&lt;BR /&gt;I have a data set like&amp;nbsp;&lt;BR /&gt;FactData :&amp;nbsp;&lt;BR /&gt;[ID BIGINT PRIMARY KEY,&lt;BR /&gt;CreateDate DATE,&lt;BR /&gt;CaseCount INT,&lt;BR /&gt;CaseValue DECIMAL(10, 2),&lt;BR /&gt;EffectiveDate DATE,&lt;BR /&gt;Type_A INT,&lt;BR /&gt;Type_B INT,&lt;BR /&gt;Type_C INT,&lt;BR /&gt;Type_D INT,&lt;BR /&gt;Type_E INT,&lt;BR /&gt;Type_F INT,&lt;BR /&gt;Type_G INT,&lt;BR /&gt;Type_H INT,&lt;BR /&gt;Type_I INT,&lt;BR /&gt;Type_J INT,&lt;BR /&gt;Type_K INT,&lt;BR /&gt;Type_L INT,&lt;BR /&gt;Type_M INT,&lt;BR /&gt;Type_N INT,&lt;BR /&gt;Type_O INT,&lt;BR /&gt;Type_P INT,&lt;BR /&gt;Type_Q INT,&lt;BR /&gt;Type_R INT,&lt;BR /&gt;Type_S INT,&lt;BR /&gt;Type_T INT,&lt;BR /&gt;Type_U INT,&lt;BR /&gt;Type_V INT,&lt;BR /&gt;Type_W INT,&lt;BR /&gt;Type_X INT,&lt;BR /&gt;Type_Y INT,&lt;BR /&gt;Type_Z INT]&lt;BR /&gt;&lt;BR /&gt;And&amp;nbsp;&lt;BR /&gt;DimType :&amp;nbsp;&lt;BR /&gt;[ID INT PRIMARY KEY,&lt;BR /&gt;Type CHAR(1),&lt;BR /&gt;Value INT]&lt;BR /&gt;&lt;BR /&gt;I need to filter my FactData with my DimType but my fact can have multiple type and I must can select multiple types.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gregoire_0-1715592873411.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1096965i64CCD9A83CCF5565/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gregoire_0-1715592873411.png" alt="Gregoire_0-1715592873411.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code but it not really quick, it take 15s to run across 5 million rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Filtered Quantity = 
VAR _SelectedTypes = VALUES('Type'[ID])

RETURN
IF(
    ISEMPTY(_SelectedTypes),
    [quantiter],
    CALCULATE(
        [quantiter],
        KEEPFILTERS(
            FILTER(
                'FactData', 
                (
					FactData[TypeA] IN _SelectedTypes ||
                    FactData[TypeB] IN _SelectedTypes ||
                    FactData[TypeC] IN _SelectedTypes ||
                    FactData[TypeD] IN _SelectedTypes ||
                    FactData[TypeE] IN _SelectedTypes ||
                    FactData[TypeF] IN _SelectedTypes ||
                    FactData[TypeG] IN _SelectedTypes ||
                    FactData[TypeH] IN _SelectedTypes ||
                    FactData[TypeI] IN _SelectedTypes ||
                    FactData[TypeJ] IN _SelectedTypes ||
                    FactData[TypeK] IN _SelectedTypes ||
                    FactData[TypeL] IN _SelectedTypes ||
                    FactData[TypeM] IN _SelectedTypes ||
                    FactData[TypeN] IN _SelectedTypes ||
                    FactData[TypeO] IN _SelectedTypes ||
                    FactData[TypeP] IN _SelectedTypes ||
                    FactData[TypeQ] IN _SelectedTypes ||
                    FactData[TypeR] IN _SelectedTypes ||
                    FactData[TypeS] IN _SelectedTypes ||
                    FactData[TypeT] IN _SelectedTypes ||
                    FactData[TypeU] IN _SelectedTypes ||
                    FactData[TypeV] IN _SelectedTypes ||
                    FactData[TypeW] IN _SelectedTypes ||
                    FactData[TypeX] IN _SelectedTypes ||
                    FactData[TypeY] IN _SelectedTypes ||
                    FactData[TypeZ] IN _SelectedTypes 
				)
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So how can I improve it?&lt;BR /&gt;&lt;BR /&gt;I have made a pbix for example with a csv file for data.&lt;BR /&gt;But I don't know if I hoe to share it.&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2024 11:40:26 GMT</pubDate>
    <dc:creator>Gregoire</dc:creator>
    <dc:date>2024-05-13T11:40:26Z</dc:date>
    <item>
      <title>How Filtering by multiple typeValue for the same Type</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3913822#M34883</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;So this is my problem.&lt;BR /&gt;I have a data set like&amp;nbsp;&lt;BR /&gt;FactData :&amp;nbsp;&lt;BR /&gt;[ID BIGINT PRIMARY KEY,&lt;BR /&gt;CreateDate DATE,&lt;BR /&gt;CaseCount INT,&lt;BR /&gt;CaseValue DECIMAL(10, 2),&lt;BR /&gt;EffectiveDate DATE,&lt;BR /&gt;Type_A INT,&lt;BR /&gt;Type_B INT,&lt;BR /&gt;Type_C INT,&lt;BR /&gt;Type_D INT,&lt;BR /&gt;Type_E INT,&lt;BR /&gt;Type_F INT,&lt;BR /&gt;Type_G INT,&lt;BR /&gt;Type_H INT,&lt;BR /&gt;Type_I INT,&lt;BR /&gt;Type_J INT,&lt;BR /&gt;Type_K INT,&lt;BR /&gt;Type_L INT,&lt;BR /&gt;Type_M INT,&lt;BR /&gt;Type_N INT,&lt;BR /&gt;Type_O INT,&lt;BR /&gt;Type_P INT,&lt;BR /&gt;Type_Q INT,&lt;BR /&gt;Type_R INT,&lt;BR /&gt;Type_S INT,&lt;BR /&gt;Type_T INT,&lt;BR /&gt;Type_U INT,&lt;BR /&gt;Type_V INT,&lt;BR /&gt;Type_W INT,&lt;BR /&gt;Type_X INT,&lt;BR /&gt;Type_Y INT,&lt;BR /&gt;Type_Z INT]&lt;BR /&gt;&lt;BR /&gt;And&amp;nbsp;&lt;BR /&gt;DimType :&amp;nbsp;&lt;BR /&gt;[ID INT PRIMARY KEY,&lt;BR /&gt;Type CHAR(1),&lt;BR /&gt;Value INT]&lt;BR /&gt;&lt;BR /&gt;I need to filter my FactData with my DimType but my fact can have multiple type and I must can select multiple types.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gregoire_0-1715592873411.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1096965i64CCD9A83CCF5565/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gregoire_0-1715592873411.png" alt="Gregoire_0-1715592873411.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code but it not really quick, it take 15s to run across 5 million rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Filtered Quantity = 
VAR _SelectedTypes = VALUES('Type'[ID])

RETURN
IF(
    ISEMPTY(_SelectedTypes),
    [quantiter],
    CALCULATE(
        [quantiter],
        KEEPFILTERS(
            FILTER(
                'FactData', 
                (
					FactData[TypeA] IN _SelectedTypes ||
                    FactData[TypeB] IN _SelectedTypes ||
                    FactData[TypeC] IN _SelectedTypes ||
                    FactData[TypeD] IN _SelectedTypes ||
                    FactData[TypeE] IN _SelectedTypes ||
                    FactData[TypeF] IN _SelectedTypes ||
                    FactData[TypeG] IN _SelectedTypes ||
                    FactData[TypeH] IN _SelectedTypes ||
                    FactData[TypeI] IN _SelectedTypes ||
                    FactData[TypeJ] IN _SelectedTypes ||
                    FactData[TypeK] IN _SelectedTypes ||
                    FactData[TypeL] IN _SelectedTypes ||
                    FactData[TypeM] IN _SelectedTypes ||
                    FactData[TypeN] IN _SelectedTypes ||
                    FactData[TypeO] IN _SelectedTypes ||
                    FactData[TypeP] IN _SelectedTypes ||
                    FactData[TypeQ] IN _SelectedTypes ||
                    FactData[TypeR] IN _SelectedTypes ||
                    FactData[TypeS] IN _SelectedTypes ||
                    FactData[TypeT] IN _SelectedTypes ||
                    FactData[TypeU] IN _SelectedTypes ||
                    FactData[TypeV] IN _SelectedTypes ||
                    FactData[TypeW] IN _SelectedTypes ||
                    FactData[TypeX] IN _SelectedTypes ||
                    FactData[TypeY] IN _SelectedTypes ||
                    FactData[TypeZ] IN _SelectedTypes 
				)
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So how can I improve it?&lt;BR /&gt;&lt;BR /&gt;I have made a pbix for example with a csv file for data.&lt;BR /&gt;But I don't know if I hoe to share it.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 11:40:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3913822#M34883</guid>
      <dc:creator>Gregoire</dc:creator>
      <dc:date>2024-05-13T11:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: How Filtering by multiple typeValue for the same Type</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3916002#M34895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/560543"&gt;@Gregoire&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Utilize the Performance Analyzer in Power BI Desktop to identify which parts of your report are slow. This tool can help you pinpoint specific visuals or queries that are taking the most time to load.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Instead of using multiple OR conditions for each type, you can use a single condition that checks if the type exists in the&amp;nbsp;_SelectedTypes&amp;nbsp;variable. This will reduce the number of comparisons and improve performance.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Xianda Tang&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 05:51:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3916002#M34895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-14T05:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: How Filtering by multiple typeValue for the same Type</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3916220#M34899</link>
      <description>&lt;P&gt;I already know is the measue how take long to resolve and the Performance Analyzer confirm it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Instead of using multiple OR conditions for each type, you can use a single condition that checks if the type exists in the&amp;nbsp;_SelectedTypes&amp;nbsp;variable. &lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;How can I do that?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 07:04:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/How-Filtering-by-multiple-typeValue-for-the-same-Type/m-p/3916220#M34899</guid>
      <dc:creator>Gregoire</dc:creator>
      <dc:date>2024-05-14T07:04:28Z</dc:date>
    </item>
  </channel>
</rss>

