<?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: Making CALCULATETABLE filter by selected column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937474#M96902</link>
    <description>&lt;P&gt;Please try something like below to create a calculated table whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table4 =
UNION (
    CALCULATETABLE ( Table1, Table1[Type] = "A" ),
    CALCULATETABLE ( Table2, Table2[Type] = "A" )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Nov 2022 04:13:07 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-11-30T04:13:07Z</dc:date>
    <item>
      <title>Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937423#M96898</link>
      <description>&lt;P&gt;I have data like this in two tables as Table1 and Table2, with same columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In my PowerBI report, I have two filters on Table1's Type and Table2's Type columns like below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With these two filters selected I want to UNION the resultant filtered result set from Table1 and Table2 as the output.&amp;nb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&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table2&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Table2&lt;/SPAN&gt;&lt;SPAN&gt;[Type]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Even though the Type filter for both Table1 and Table2 is selected as A, I still see all the rows in my Table3 and Table4 result set. I need a calculation where I will see the UNION of the two filtered sets instead of the whole unfiltered UNION e.g. with the selections in the visuals as Type=="A", I want to see rows with only A in the UINION;ed data. Please help with the DAX expression&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 30 Nov 2022 03:26:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937423#M96898</guid>
      <dc:creator>powerx786</dc:creator>
      <dc:date>2022-11-30T03:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937455#M96900</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but in my opinion, slicer selection from the visualization is not influencing the result when creating physical calculated table. If you want to make it happen, one of ways is to insert the condition directly into the formula to create physical calculated table.&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:03:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937455#M96900</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-11-30T04:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937470#M96901</link>
      <description>&lt;P&gt;There is nothing in the data model except two separate tables. There are no further relationships. The slicer in the report is directly referencing the column in the table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:09:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937470#M96901</guid>
      <dc:creator>powerx786</dc:creator>
      <dc:date>2022-11-30T04:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937474#M96902</link>
      <description>&lt;P&gt;Please try something like below to create a calculated table whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table4 =
UNION (
    CALCULATETABLE ( Table1, Table1[Type] = "A" ),
    CALCULATETABLE ( Table2, Table2[Type] = "A" )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:13:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937474#M96902</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-11-30T04:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937486#M96904</link>
      <description>&lt;P&gt;I do not want to give an explicit value (Table1[Type] = "A") for the filter condition as I want to filter by the value selected in the filter visual&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:44:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937486#M96904</guid>
      <dc:creator>powerx786</dc:creator>
      <dc:date>2022-11-30T04:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937488#M96905</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="254546" data-lia-user-login="powerx786" class="lia-mention lia-mention-user"&gt;powerx786&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Apparently you can create calculated tables. In this case best is to create a common dimension table that filters both tables.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Types =
DISTINCT (
    UNION ( ALLNOBLANKROW ( Table1[Type] ), ALLNOBLANKROW ( Table2[Type] ) )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly you can have a dimension date table that filters the date in both tables. Therefore, you can place the date from the date table in the table visual.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Then create a one to many relationship between this table and both tables. You can use this column to slice by in the table visual. Then add the following measure to the same table visual.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Total Amount =
SUM ( Table1[Amount] ) + SUM ( Table2[Amount] )&lt;/LI-CODE&gt;
&lt;P&gt;Please note that the results of both tables will be merged together and aggregated at Type-Date level.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:22:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937488#M96905</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-11-30T04:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937519#M96908</link>
      <description>&lt;P&gt;Unfortunately I do not want to create a common dimension that filters both tables, as the idea is to be able to filter both tables using separate filtering conditions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example I just so happened to show one column with same name from both tables, for simplicity. But there could be different filters with different values on either table for the sake of comparing the final calculated table difference between Table1 and Table2 (I will also add a column to indicate if the particular row comes from Table1 or Table2)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 04:44:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2937519#M96908</guid>
      <dc:creator>powerx786</dc:creator>
      <dc:date>2022-11-30T04:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Making CALCULATETABLE filter by selected column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2938279#M96940</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="254546" data-lia-user-login="powerx786" class="lia-mention lia-mention-user"&gt;powerx786&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I'm just thinking outloud trying to find a reasonable solution without having to dive deep into complex DAX.&lt;/P&gt;
&lt;P&gt;Here is one approach.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Let's say that we know that Table1 has around 120K rows, then you can add (in the query editor) an index column to Table1 starts from 1 then add an index column to Table2 starts from 200,000 just to keep a room for future data expansion of Table1.&lt;/LI&gt;
&lt;LI&gt;Now we can create an Index Table:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Index Table = SELECTCOLUMNS ( GENERATESERIES ( 1, MAX ( Table2[Index] ), 1 ), "Index", [Value] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create a relationship between the index table and both tables.&lt;/LI&gt;
&lt;LI&gt;Place the index column of the index table in a table visual.&lt;/LI&gt;
&lt;LI&gt;Now you should be able to combine any column from both tables using measures as follows:&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For text columns&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Measure1 = SELECTEDVALUE ( Table1[Column1] ) &amp;amp; SELECTEDVALUE ( Table2[Column1] ) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For date or decimal data type columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Measure2 = SELECTEDVALUE ( Table1[Column2] ) + SELECTEDVALUE ( Table2[Column2] ) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Please let me know if this aproach works with you.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 09:25:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Making-CALCULATETABLE-filter-by-selected-column/m-p/2938279#M96940</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-11-30T09:25:06Z</dc:date>
    </item>
  </channel>
</rss>

