<?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: Help understanding the function VALUES when passed as a filter parameter in Calculation in Dax in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2233087#M53316</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="168297" data-lia-user-login="bcdobbs" class="lia-mention lia-mention-user"&gt;bcdobbs&lt;/a&gt;&amp;nbsp;is correct. VALUES is restoring the local ProductId filter context that CALCULATE replaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just wanted to suggest using &lt;A href="https://www.sqlbi.com/articles/using-keepfilters-in-dax/" target="_blank"&gt;KEEPFILTERS&lt;/A&gt; in your measure like this rather than VALUES:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    Sales[Sum revenue],
    KEEPFILTERS ( 'Product'[ProductID] &amp;gt; 10 )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2021 18:12:54 GMT</pubDate>
    <dc:creator>AlexisOlson</dc:creator>
    <dc:date>2021-12-10T18:12:54Z</dc:date>
    <item>
      <title>Help understanding the function VALUES when passed as a filter parameter in Calculation in Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2232778#M53290</link>
      <description>&lt;P&gt;Hi everyone, I want to display the revenue of each product where its productID is greater than 10. I have a Dax formula as bellow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue of productID greater than 10 :=  CALCULATE(Sales[Sum revenue],'Product'[ProductID]&amp;gt;10))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This return a table that is not as expected because the revenue is the same with all productIDs:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When I modify the Dax to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Revenue of productID greater than 10 = 
Var productIDContext = VALUES('Product'[ProductID])
return CALCULATE(Sales[Sum revenue],'Product'[ProductID]&amp;gt;10,productIDContext)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It returns the result as expected&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In conclusion, I want to what variable productIDContext is really doing in this Dax formulae, it seems that the filter:&amp;nbsp;&lt;SPAN&gt;'Product'[ProductID]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;10&amp;nbsp; has overwritten the filter context of productID outside the calculation function so we need productIDContext to regain it, but I still could not understand exactly the under the mechanism of Dax to merge the initial filter context of productID outside the Calculate function and 2 filter parameters inside the Calculate function. Can someones please explain this to me? Sorry for my bad english.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 15:05:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2232778#M53290</guid>
      <dc:creator>TommyNguyen</dc:creator>
      <dc:date>2021-12-10T15:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding the function VALUES when passed as a filter parameter in Calculation in Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2232816#M53293</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When you write&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(
  [Sum revenue],
  'Product'[ProductID]&amp;gt;10
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX actually goes away and does this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(
  [Sum revenue],
  FILTER(
    ALL('Product'[ProductID]),
    'Product'[ProductId] &amp;gt; 10
  )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;eg it removes any existing filters on product id (eg the ones coming from the matrix rows and then it adds a new filter to just get ids greater than 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the measure that is working it does the same but VALUES('Product'[ProductId]) add back the existing Product Ids that were in the filter context to start with.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 15:27:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2232816#M53293</guid>
      <dc:creator>bcdobbs</dc:creator>
      <dc:date>2021-12-10T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding the function VALUES when passed as a filter parameter in Calculation in Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2233087#M53316</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="168297" data-lia-user-login="bcdobbs" class="lia-mention lia-mention-user"&gt;bcdobbs&lt;/a&gt;&amp;nbsp;is correct. VALUES is restoring the local ProductId filter context that CALCULATE replaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just wanted to suggest using &lt;A href="https://www.sqlbi.com/articles/using-keepfilters-in-dax/" target="_blank"&gt;KEEPFILTERS&lt;/A&gt; in your measure like this rather than VALUES:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    Sales[Sum revenue],
    KEEPFILTERS ( 'Product'[ProductID] &amp;gt; 10 )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 18:12:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2233087#M53316</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-10T18:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding the function VALUES when passed as a filter parameter in Calculation in Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2233837#M53344</link>
      <description>&lt;P&gt;Thanks for you your support&lt;/P&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:43:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-the-function-VALUES-when-passed-as-a-filter/m-p/2233837#M53344</guid>
      <dc:creator>TommyNguyen</dc:creator>
      <dc:date>2021-12-11T16:43:04Z</dc:date>
    </item>
  </channel>
</rss>

