<?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: Measure displays values for excluded categories - what am I misunderstanding? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2769208#M86121</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237689" data-lia-user-login="sean_cochran" class="lia-mention lia-mention-user"&gt;sean_cochran&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your understanding is correct, you can refer to the documentation about KEEPFILTERS():&amp;nbsp;&lt;A tabindex="-1" title="https://docs.microsoft.com/en-us/dax/keepfilters-function-dax" href="https://docs.microsoft.com/en-us/dax/keepfilters-function-dax" target="_blank" rel="noopener noreferrer" aria-label="Link https://docs.microsoft.com/en-us/dax/keepfilters-function-dax"&gt;https://docs.microsoft.com/en-us/dax/keepfilters-function-dax&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Second, if you don't want to use the KEEPFILTERS() function you can also use the following DAX:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVG Production Hourly Wage =
CALCULATE (
    ( SUM ( 'Test'[Weighted Amount] ) / SUM ( 'Test'[BLS Employees(Thousands)] ) ),
    FILTER ( 'Test', 'Test'[BLS Data Population Type] = "Production" )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2022 06:36:22 GMT</pubDate>
    <dc:creator>v-yueyunzh-msft</dc:creator>
    <dc:date>2022-09-15T06:36:22Z</dc:date>
    <item>
      <title>Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2765383#M85875</link>
      <description>&lt;P&gt;I have a table of average wage data from the bureau of labor statistics:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a measure that shows the weighted average of hourly wages for the "Production" population type only. I added a calculated column ("Weighted Amount" = hourly wage * employee count) to help with the weighted average calculation. I created a measure that divides the sum of weighted amount by the sum of employees:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AVG Production Hourly Wage =

CALCULATE(
    (
     SUM(FactBLSHourly[Weighted Amount]) / SUM(FactBLSHourly[BLS Employees (Thousands)])
     ),
    FactBLSHourly[BLS Data Population Type] = "Production"
)&lt;/LI-CODE&gt;&lt;P&gt;This works, but values also appear for the "Total" population type as well:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I expected there to be no values for the "Total" population type. The CALCULATE statement excludes them. Why are values showing up in the excluded category, and what am I misunderstanding about this measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample file with data available upon request.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 20:47:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2765383#M85875</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2022-09-13T20:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2766278#M85923</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237689" data-lia-user-login="sean_cochran" class="lia-mention lia-mention-user"&gt;sean_cochran&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description According to your description, you have doubts about the return result of the metric you wrote. Right?&lt;/P&gt;
&lt;P&gt;Here is my explanation:&lt;/P&gt;
&lt;P&gt;(1) First, based on your measure, we can write an equivalent measure as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVG Production Hourly Wage =

CALCULATE(

    (

     SUM('Test'[Weighted Amount]) / SUM('Test'[BLS Employees(Thousands)])

     ),

   FILTER(ALL(Test[BLS Data Population Type]), 'Test'[BLS Data Population Type] = "Production")

)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) We can see that using a boolean expression below the CALCULATE() function will automatically clear the filter of the [BLS Data Population Type] column, thus displaying data in the visual that is inconsistent with the expected result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3) For the filter of CALCULATE(), we need to keep the filter of the column on the visual object, we can add the KEEPFILTERS() function outside the filter, the result is as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVG Production Hourly Wage =

CALCULATE(

    (

     SUM('Test'[Weighted Amount]) / SUM('Test'[BLS Employees(Thousands)])

     ),

   KEEPFILTERS('Test'[BLS Data Population Type] = "Production")

)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 07:01:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2766278#M85923</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-14T07:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2767419#M86008</link>
      <description>&lt;P&gt;Thank you! This is the first time I have encountered the KEEPFILTERS function. I want to make sure I understand. By default, a measure made with the CALCULATE function will disregard any segmenters that are used as filters. Because I used the column&amp;nbsp;[BLS Data Population Type] as a filter in a CALCULATE function, the resulting measure did not respect [BLS Data Population Type] in the filter context of visualizations (such as a table). The solution to this was to wrap the filter in the "KEEPFILTER" function, which forces the measure to respect this column again. Is this correct?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 13:26:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2767419#M86008</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2022-09-14T13:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2767421#M86009</link>
      <description>&lt;P&gt;Thank you! This is the first time I have encountered the KEEPFILTERS function. I want to make sure I understand. By default, a measure made with the CALCULATE function will disregard any segmenters that are used as filters. Because I used the column&amp;nbsp;[BLS Data Population Type] as a filter in a CALCULATE function, the resulting measure did not respect [BLS Data Population Type] in the filter context of visualizations (such as a table). The solution to this was to wrap the filter in the "KEEPFILTER" function, which forces the measure to respect this column again. Is this correct?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 13:26:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2767421#M86009</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2022-09-14T13:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2769208#M86121</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="237689" data-lia-user-login="sean_cochran" class="lia-mention lia-mention-user"&gt;sean_cochran&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your understanding is correct, you can refer to the documentation about KEEPFILTERS():&amp;nbsp;&lt;A tabindex="-1" title="https://docs.microsoft.com/en-us/dax/keepfilters-function-dax" href="https://docs.microsoft.com/en-us/dax/keepfilters-function-dax" target="_blank" rel="noopener noreferrer" aria-label="Link https://docs.microsoft.com/en-us/dax/keepfilters-function-dax"&gt;https://docs.microsoft.com/en-us/dax/keepfilters-function-dax&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Second, if you don't want to use the KEEPFILTERS() function you can also use the following DAX:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVG Production Hourly Wage =
CALCULATE (
    ( SUM ( 'Test'[Weighted Amount] ) / SUM ( 'Test'[BLS Employees(Thousands)] ) ),
    FILTER ( 'Test', 'Test'[BLS Data Population Type] = "Production" )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 06:36:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2769208#M86121</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-15T06:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Measure displays values for excluded categories - what am I misunderstanding?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2770658#M86246</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 13:39:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-displays-values-for-excluded-categories-what-am-I/m-p/2770658#M86246</guid>
      <dc:creator>sean_cochran</dc:creator>
      <dc:date>2022-09-15T13:39:05Z</dc:date>
    </item>
  </channel>
</rss>

