<?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: Filter context not passing onto measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081453#M107413</link>
    <description>&lt;P&gt;I've popped in the formula you were suggesting, wihtout selecting anything from the slicer that shows the Type field from DateSelections table I get values, same as before so that's working however....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then I select WTD for instance and the LY value disappears still. I know that my fact table contains that data for last year for this week, if you manually query the data for those dates, the values are there. And the formula does return the correct LY value if I use any slicers that point to my Calendar table and not the DateSelection table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 12:55:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-02-15T12:55:54Z</dc:date>
    <item>
      <title>Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081117#M107391</link>
      <description>&lt;P&gt;Hi Power BI Brains!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a bit of help please, I've been stuck on this problem and don't fully understand why it's happening. I've got a dataset that contains a Calendar table and a Sales Detail fact table that have a one to many join between them, single direction from Calendar to the Sales table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created a table of explicit measures: a set of measures for the current year and a set for the previous year (based on the dates in my Calendar table where each calendar date has a YOY date in the financial year which does not align with the standard gregorian calendar).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales Unit Va&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;lue= &lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;('Sales Daily Detail'[Invoiced Sales Unit Value])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales Unit Value LY = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _MaxDate = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Sales Daily Detail'[YOY Event Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _MinDate = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;('Sales Daily Detail'[YOY Event Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;([Sales Unit Value],&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;('Sales Daily Detail'),'Sales Daily Detail'[Event Date]&amp;gt;=_MinDate&amp;amp;&amp;amp;'Sales Daily Detail'[Event Date]&amp;lt;=_MaxDate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The LY measure works as intended, it's supposed to be flexible so that when the user uses the dataset for self-serve queries they can use the LY metric for whatever date range they need. If I filter the Calendar table with a slicer, I get the correct LY value, happy with that part.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But... this is where the problem comes, I t&lt;/SPAN&gt;&lt;SPAN&gt;hen I created a DateSelections table as per this video (&lt;/SPAN&gt;&lt;A href="https://www.youtube.com/watch?v=fKygF7VEJnQ" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=fKygF7VEJnQ&lt;/A&gt;&lt;SPAN&gt;) to provide my users with a pre-defined list of time periods they can select in the report as well as a Custom Date range, because this dataset is also used for a lot of dashboards.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DateSelections table that I created for my pre-defined periods has a one to many relationship filtering both ways to the Calendar table and has *no* relationship to the fact table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I select let's say "Week to Date" on my dropdown using&amp;nbsp;DateSelections&amp;nbsp; then it goes and filters my Calendar table which then correctly filters my Sales Fact table and returns the correct&amp;nbsp;&lt;SPAN&gt;Sales Unit Value. Here's the weird part... Sales Unit Value LY goes blank! If I create a slicer that has any field in from the Calendar table and I use that to filter the sales fact talbe,&amp;nbsp;Sales Unit Value LY is correctly returned.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If DateSelections filters Calendar and Calendar filters Sales fact then why is the&amp;nbsp;Sales Unit Value LY metric not populating&amp;nbsp;&lt;STRONG&gt;at all&lt;/STRONG&gt; when I make a selection in DateSelections?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am quite confused, I suspect it's to do with not being able to pass a filter context onto a second table or something? I tried&amp;nbsp; adding an inactive relationship between DateSelections and the Sales Fact and then use USERELATIONSHIP but the problem persisted.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any thoughts on what I'm doing wrong??&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:14:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081117#M107391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-15T09:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081184#M107395</link>
      <description>&lt;P&gt;In your measure you are placing a filter on the date column in the fact table, you need to put the filter on the date table. The reason that the measure is returning blank is that there is a filter on the date table for dates this year, which passes to the fact table, and then a filter on the fact table for dates last year. those 2 filters combined will result in an empty table, so the measure returns blank.&lt;/P&gt;
&lt;P&gt;By putting the filter on the date table, when you add the filter for last year DAX will automatically replace any existing filters rather than combining them, as long as your date table is properly marked as a date table.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:45:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081184#M107395</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-02-15T09:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081233#M107397</link>
      <description>&lt;P&gt;Hi johnt75,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if I understand your suggestion then the LY value should have the following DAX:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales Unit Value LY = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_MaxDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar by Calendar Date'&lt;/SPAN&gt;&lt;SPAN&gt;[YOY Financial Calendar Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_MinDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar by Calendar Date'&lt;/SPAN&gt;&lt;SPAN&gt;[YOY Financial Calendar Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Sales Unit Value]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Sales Daily Detail'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Sales Daily Detail'&lt;/SPAN&gt;&lt;SPAN&gt;[Event Date]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN&gt;_MinDate&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;'Sales Daily Detail'&lt;/SPAN&gt;&lt;SPAN&gt;[Event Date]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;_MaxDate&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Just tried this and it's working for picking up all the dates for LY that exist even beyond today's date, which is something my previous formula couldn't do so thank you for that, that's one problem fixed! &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However when I select one of the pre-defined options in my DateSelections table the LY still goes blank. There is no direct relationship between this manually created table and my sales fact table, but I would have expected the relationship between DateSelections and my Calendar to then filter the Sales table as it does when I select a table in the Calendar table directly.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Included the table relationships for clarity&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 10:31:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081233#M107397</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-15T10:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081267#M107399</link>
      <description>&lt;P&gt;You've still got the filter on the fact table. Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales Unit Value LY =
VAR _MaxDate =
    CALCULATE ( MAX ( 'Calendar by Calendar Date'[YOY Financial Calendar Date] ) )
VAR _MinDate =
    CALCULATE ( MIN ( 'Calendar by Calendar Date'[YOY Financial Calendar Date] ) )
RETURN
    CALCULATE (
        [Sales Unit Value],
        ALL ( 'Sales Daily Detail' ),
        'Calendar by Calendar Date'[Date] &amp;gt;= _MinDate
            &amp;amp;&amp;amp; 'Calendar by Calendar Date'[Date] &amp;lt;= _MaxDate
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Feb 2023 10:57:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081267#M107399</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-02-15T10:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081453#M107413</link>
      <description>&lt;P&gt;I've popped in the formula you were suggesting, wihtout selecting anything from the slicer that shows the Type field from DateSelections table I get values, same as before so that's working however....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Then I select WTD for instance and the LY value disappears still. I know that my fact table contains that data for last year for this week, if you manually query the data for those dates, the values are there. And the formula does return the correct LY value if I use any slicers that point to my Calendar table and not the DateSelection table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 12:55:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081453#M107413</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-15T12:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081520#M107418</link>
      <description>&lt;P&gt;Change the measure to store the result of the final CALCULATE in a variable and then you can check that the dates being returned are what you expect by having the measure return first the min date and then change it again to return the max date.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 13:39:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081520#M107418</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-02-15T13:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081538#M107422</link>
      <description>&lt;P&gt;I tested this early on in my testing process and the dates returned are correct.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 13:53:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081538#M107422</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-15T13:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081730#M107449</link>
      <description>&lt;P&gt;You need to explicitly remove the filters from the date selection table, the automatic removal of filters only applies to the date table itself, not the expanded table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales Unit Value LY =
VAR _MaxDate =
    CALCULATE ( MAX ( 'Calendar by Calendar Date'[YOY Financial Calendar Date] ) )
VAR _MinDate =
    CALCULATE ( MIN ( 'Calendar by Calendar Date'[YOY Financial Calendar Date] ) )
RETURN
    CALCULATE (
        [Sales Unit Value],
        ALL ( 'Sales Daily Detail' ),
        REMOVEFILTERS ( 'Date Selections' ),
        'Calendar by Calendar Date'[Date] &amp;gt;= _MinDate
            &amp;amp;&amp;amp; 'Calendar by Calendar Date'[Date] &amp;lt;= _MaxDate
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:29:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081730#M107449</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-02-15T15:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Filter context not passing onto measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081780#M107455</link>
      <description>&lt;P&gt;Thank you, using the REMOVEFILTERS actually resolved it!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:51:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-context-not-passing-onto-measure/m-p/3081780#M107455</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-15T15:51:03Z</dc:date>
    </item>
  </channel>
</rss>

