<?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: Remove Filter Context to create &amp;quot;materialized&amp;quot; table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1589434#M31896</link>
    <description>&lt;P&gt;Thx! I did not know you could use var inside measure expressions. That will help indeed.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2021 08:42:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-01-11T08:42:40Z</dc:date>
    <item>
      <title>Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588837#M31881</link>
      <description>&lt;P&gt;Is there any way in DAX to create a derived table based on a filter expression and prevent any downstream calculations from ignoring the filter expression via functions like ALLEXCEPT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, users of the table must not be able to anyhow affect pre-filtering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would expect Power BI "new table" to behave like this, but I am not sure if it does.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 14:20:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588837#M31881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-10T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588901#M31885</link>
      <description>&lt;P&gt;Yes, there are several ways.&amp;nbsp; But without any additional information, it would be very difficult to describe how exactly.&lt;BR /&gt;&lt;BR /&gt;Are you looking it to be permanent, usable in visualizations and so forth?&amp;nbsp; Or just temporary as part of calculating a measure?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 18:18:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588901#M31885</guid>
      <dc:creator>littlemojopuppy</dc:creator>
      <dc:date>2021-01-10T18:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588902#M31886</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, any calculated table (created by "new table") can't interact with users at all.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 18:19:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588902#M31886</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2021-01-10T18:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588926#M31887</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;, thx for confirmation!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="17198" data-lia-user-login="littlemojopuppy" class="lia-mention lia-mention-user"&gt;littlemojopuppy&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original trouble: power-bi page has multiple charts and all of them are using same source table, but there is one chart that uses subset of the table and the chart is a percentage-of-sub-total one. To calculate sub-total excluding one dimension I use ALLEXCEPT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then it depends on where I apply subset filter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;on page\chart level: ALLEXCEPT overrides it&lt;/LI&gt;&lt;LI&gt;anywhere upstream from the subtotal measure: ALLEXCEPT overrides it&lt;/LI&gt;&lt;LI&gt;"new table" via Power-BI menu: works fine, but it feels odd to create new tables every time I have to use ALLEXCEPT (I even started prefixing them with underscore...); also it makes playing with filters on chart-level impossible&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In DAX Studio it also could be helpful, for instance:&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;SUMMARIZE(
  FILTER(sessions, [next-preparing-group] &amp;lt;&amp;gt; "else"),
  [connector],
  [next-preparing-group],
  [L1]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make this FILTER to be unoverridable to make my life easier. ALLEXCEPT happily overrides the filter in any downstream calculation and it is very hard at my experience level to notice a mistake. ALLSELECTED just feels too dangerous when you have many measures in SUMMARIZE.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 19:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588926#M31887</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-10T19:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588940#M31889</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;is correct in that if you create a table using DAX it will not respond to filters, etc.&amp;nbsp; It will be created and populated only when the report file is opened or when data is refreshed.&amp;nbsp; I am not a fan of creating individual tables for each and every visualization...and you seem to agree with that sentiment&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A low end solution could be to put filters directly onto the visualizations themselves and you can also alter the interactions between other visualizations and the one in question so they do not cross filter it.&amp;nbsp; Might work for what you need and it's simple and easy.&lt;BR /&gt;&lt;BR /&gt;A higher end (and probably better) solution would be to create table variables in the measures themselves to include/exclude only what you want in the calculation.&amp;nbsp; For example, if you wanted to create a measure that calculates Total Sales only for a range of dates in a slicer it could look something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure =
VAR	SelectedDates = VALUES('Calendar'[Date])
RETURN

CALCULATE(
	[Total Sales],
	SelectedDates
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Another example would be this...if you only wanted to calculate Total Sales for all products (regardless of filter context) with sales greater than $1M and profit less than $100k you could do that like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure =
VAR	ProductSummary =
	SUMMARIZE(
		Products,
		ALL(Product[ID]),
		"TotalSales",
		[Total Sales],
		"TotalProfit"
		[Total Profit]
	)
RETURN

CALCULATE(
	[Total Sales],
	FILTER(
		ProductSummary,
		[TotalSales] &amp;gt;= 1000000 &amp;amp;&amp;amp;
		[TotalProfit] &amp;lt; 100000
	)
)&lt;/LI-CODE&gt;&lt;P&gt;There are - of course - many different ways to achieve both these results without necessarily using a table variable.&amp;nbsp; I'm just trying to demonstrate using table variables as filters in defining measures.&amp;nbsp; The good thing about including your filters in the measure definition is that it will override (if defined correctly) the filter context from slicers, cross filtering, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that answer your question or did I make this more confusing?&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jan 2021 20:09:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1588940#M31889</guid>
      <dc:creator>littlemojopuppy</dc:creator>
      <dc:date>2021-01-10T20:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1589434#M31896</link>
      <description>&lt;P&gt;Thx! I did not know you could use var inside measure expressions. That will help indeed.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 08:42:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1589434#M31896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-01-11T08:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Filter Context to create "materialized" table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1590421#M31936</link>
      <description>&lt;P&gt;Glad I could help!&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 23:13:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-Filter-Context-to-create-quot-materialized-quot-table/m-p/1590421#M31936</guid>
      <dc:creator>littlemojopuppy</dc:creator>
      <dc:date>2021-01-11T23:13:27Z</dc:date>
    </item>
  </channel>
</rss>

