<?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: DAX filter calculated table based on another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2095339#M47760</link>
    <description>&lt;P&gt;Thank you it worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Sep 2021 20:21:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-09-23T20:21:55Z</dc:date>
    <item>
      <title>DAX filter calculated table based on another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2086870#M47462</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist me with this DAX measure I'm trying to calculate the sum of inventory based on the countries for a selected user.&lt;/P&gt;&lt;P&gt;I have attached my pbix file with the measure&amp;nbsp; called "TotalInventoryProcessedForSelectedUserCountries"&lt;/P&gt;&lt;P&gt;I'm trying to get the total for all users which had the same countries with inventory as Ann where from 25 April to 1 May 2020 Ann had inventory in 6 countries (Brazil,Canada,Ireland,Mexico,US and Venezuela). I need the total inventory for all users who had inventory in those same 6 countries. My measure now returns all users and all countries but I need only the selected user's countries.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PBIX file link -&amp;nbsp;&lt;A href="https://www.dropbox.com/s/5rxhb0ajieqwzyj/TableFilter.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/5rxhb0ajieqwzyj/TableFilter.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My DAX code :=&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;TotalInventoryProcessedForSelectedUserCountries = &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;VAR FirstDateSelected = MIN('DimDates'[Date])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;var LastDateSelected = MAX('DimDates'[Date])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;VAR Result =&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;CALCULATETABLE(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;FILTER(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;ADDCOLUMNS(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;SUMMARIZE(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'data',&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;data[User Name],&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'data'[Country]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;),&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;"@InventoryProcessed",[SumOfInventoryProcessed]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;,[@InventoryProcessed]&amp;gt;0&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;),&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;FILTER(ALL('DimDates'),&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'DimDates'[Date] &amp;gt;= FirstDateSelected &amp;amp;&amp;amp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'DimDates'[Date] &amp;lt;= LastDateSelected&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;,ALL('data'[Country])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;,ALL( data[User Name])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;RETURN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;SUMX(Result,[@InventoryProcessed])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 18:26:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2086870#M47462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-20T18:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: DAX filter calculated table based on another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2088150#M47508</link>
      <description>&lt;P&gt;Hey&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I found an easier way.&lt;/P&gt;&lt;P&gt;First I get the countries for the current user and then I just use that list as a filter for calculate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check the following approach:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TotInventory =
-- Get all countries for the current user
VAR vCountries =
    CALCULATETABLE(
        VALUES( data[Country] ),
        ALLEXCEPT(
            data,
            data[User Name]
        )
    )
RETURN
    -- return the [SumOfInventoryProcessed] and we use
    -- as only filter the countries from the first step
    CALCULATE(
        [SumOfInventoryProcessed],
        vCountries,
        ALL( data )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;If you need any help please let me know.&lt;/DIV&gt;&lt;DIV&gt;If I answered your question I would be happy if you could mark my post as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; and give it a thumbs up &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Best regards&lt;/DIV&gt;&lt;DIV&gt;Denis&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Blog: &lt;A title="Click here!" href="https://whatthefact.bi/?utm_source=powerbicommunity&amp;amp;utm_medium=link&amp;amp;utm_campaign=forum" target="_blank" rel="noopener"&gt;&lt;U&gt;WhatTheFact.bi&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;Follow me: &lt;A title="Click here!" href="https://twitter.com/DenSelimovic" target="_blank" rel="noopener"&gt;&lt;U&gt;twitter.com/DenSelimovic&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 Sep 2021 08:38:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2088150#M47508</guid>
      <dc:creator>selimovd</dc:creator>
      <dc:date>2021-09-21T08:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: DAX filter calculated table based on another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2095339#M47760</link>
      <description>&lt;P&gt;Thank you it worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 20:21:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-filter-calculated-table-based-on-another-table/m-p/2095339#M47760</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-23T20:21:55Z</dc:date>
    </item>
  </channel>
</rss>

