<?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: Make a measure that filters a fact table respect the slicer visual in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3801173#M148613</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="714627" data-lia-user-login="dimitrisbut" class="lia-mention lia-mention-user"&gt;dimitrisbut&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try ALLSELECTED function:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TimeFrame Count =
CALCULATE(
     COUNTROWS('Actual'),
     FILTER(
         'Actual',
         'Actual'[ID] = EARLIER('Actual'[ID])
         &amp;amp;&amp;amp; 'Actual'[TimeFrame] = EARLIER('Actual'[TimeFrame])
     ),
     ALLSELECTED('Dates')
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ALLSELECTED function returns all values in all rows or columns in a table, ignoring any filters that may have been applied inside the query, but retaining filters from outside.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more information about the ALLSELECTED function, please see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allselected-function-dax" target="_blank"&gt;ALLSELECTED function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://dax.guide/allselected/" target="_blank"&gt;ALLSELECTED - DAX Guide&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any further questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;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.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 02:35:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-04-01T02:35:56Z</dc:date>
    <item>
      <title>Make a measure that filters a fact table respect the slicer visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3798774#M148482</link>
      <description>&lt;P&gt;I have the following DAX measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TimeFrame Count =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV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p;nbsp; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Dates'&lt;/SPAN&gt;&lt;SPAN&gt;[Month Name]&lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;"February"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Dates'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Year]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"2023-2024"&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;I would like to remove the last two filters,&amp;nbsp;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;'Dates'&lt;/SPAN&gt;&lt;SPAN&gt;[Month Name]&lt;/SPAN&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;"February"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Dates'&lt;/SPAN&gt;&lt;SPAN&gt;[Fiscal Year]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"2023-2024",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and make the measure work more dynamically based on month and year slicers. However, if I do remove them, The measure somehow ignores the month and year slicers I have on the page and uses the entire fact table for the calculations. How can I solve this and why does this happen?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Mar 2024 10:43:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3798774#M148482</guid>
      <dc:creator>dimitrisbut</dc:creator>
      <dc:date>2024-03-29T10:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Make a measure that filters a fact table respect the slicer visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3798796#M148484</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TimeFrame Count =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('Actual'),&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('Dates'),&lt;BR /&gt;'Dates'[Month Name] IN VALUES('Dates'[Month Name])&lt;BR /&gt;&amp;amp;&amp;amp; 'Dates'[Fiscal Year] IN VALUES('Dates'[Fiscal Year])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measure removes the hardcoded filters and instead uses the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function to return the current filter context for the ‘Dates’[Month Name] and ‘Dates’[Fiscal Year] columns, which is set by the slicers. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ALL&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function is used to remove any existing filters on the ‘Dates’ table before applying the new filter context.&lt;/P&gt;&lt;P&gt;The reason your measure was ignoring the slicers when you removed the hardcoded filters is likely because the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;EARLIER&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function was creating a row context that was not interacting with the filter context from the slicers. By using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;VALUES, you ensure that the measure respects the current filter context, which includes the slicer selections.&lt;/P&gt;&lt;P&gt;Remember to replace ‘Actual’ and ‘Dates’ with the actual names of your tables if they are different. Also, ensure that your slicers are correctly configured to interact with the ‘Dates’ table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 10:53:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3798796#M148484</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-03-29T10:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Make a measure that filters a fact table respect the slicer visual</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3801173#M148613</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="714627" data-lia-user-login="dimitrisbut" class="lia-mention lia-mention-user"&gt;dimitrisbut&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403667" data-lia-user-login="123abc" class="lia-mention lia-mention-user"&gt;123abc&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try ALLSELECTED function:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TimeFrame Count =
CALCULATE(
     COUNTROWS('Actual'),
     FILTER(
         'Actual',
         'Actual'[ID] = EARLIER('Actual'[ID])
         &amp;amp;&amp;amp; 'Actual'[TimeFrame] = EARLIER('Actual'[TimeFrame])
     ),
     ALLSELECTED('Dates')
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ALLSELECTED function returns all values in all rows or columns in a table, ignoring any filters that may have been applied inside the query, but retaining filters from outside.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more information about the ALLSELECTED function, please see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allselected-function-dax" target="_blank"&gt;ALLSELECTED function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://dax.guide/allselected/" target="_blank"&gt;ALLSELECTED - DAX Guide&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any further questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;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.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 02:35:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Make-a-measure-that-filters-a-fact-table-respect-the-slicer/m-p/3801173#M148613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-01T02:35:56Z</dc:date>
    </item>
  </channel>
</rss>

