<?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: CALCULATE conditional filters for specific circumstances in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2605524#M75424</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your logic correctly, but please check the below picture and the attached pbix file.&lt;/P&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;LI-CODE lang="markup"&gt;Avg duration with the condition measure: =
AVERAGEX (
    FILTER (
        Data,
        SWITCH (
            TRUE (),
            Data[Action] = "Running",
                Data[Factor A] &amp;lt;&amp;gt; "Yes"
                    &amp;amp;&amp;amp; Data[Factor B] &amp;lt;&amp;gt; "Yes",
            Data[Action] = "Jumping jacks",
                Data[Evaluation] &amp;lt;&amp;gt; "Bad"
                    &amp;amp;&amp;amp; OR ( Data[Factor A] = "Yes", Data[Factor B] = "Yes" )
        )
    ),
    Data[Duration (minutes)]
)
&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 28 Jun 2022 03:22:15 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-06-28T03:22:15Z</dc:date>
    <item>
      <title>CALCULATE conditional filters for specific circumstances</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2605293#M75407</link>
      <description>&lt;P&gt;Lets say I had a table like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&g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lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jumping jacks&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;Good&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a DAX formula below that is meant to average the Duration field, excluding rows where the Evaluation is "Bad", Factor A is "Yes", and/or Factor B is "Yes."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Duration Average = CALCULATE(&lt;BR /&gt;AVERAGE('Table'[Duration (minutes)]),&lt;BR /&gt;'Table'[Evaluation] &amp;lt;&amp;gt; "Bad",&lt;BR /&gt;'Table'[Factor A] &amp;lt;&amp;gt; "Yes",&lt;BR /&gt;'Table'[Factor B] &amp;lt;&amp;gt; "Yes"&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets say that for Jumping Jacks, I do want to include rows where Factor A is "Yes" and/or Factor B is "Yes." For running, I want to exclude rows where Factor A is "Yes" and/or Factor B is "Yes."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way that I can adjust this DAX formula so it only excludes Factor A and Factor B for "Running" rows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be simple to write two separate DAX formulas, but my boss wants me to create a table that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Action&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average Duration&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Jumping jacks&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Running&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way I can figure out to have one column for average Durations is to have a single DAX average formula.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another alternative I thought of was using Power Query to remove running durations with Factor A and/or Factor B, but my boss does not want me to use Power Query to alter the table in that way.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 00:47:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2605293#M75407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-28T00:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE conditional filters for specific circumstances</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2605524#M75424</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your logic correctly, but please check the below picture and the attached pbix file.&lt;/P&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;LI-CODE lang="markup"&gt;Avg duration with the condition measure: =
AVERAGEX (
    FILTER (
        Data,
        SWITCH (
            TRUE (),
            Data[Action] = "Running",
                Data[Factor A] &amp;lt;&amp;gt; "Yes"
                    &amp;amp;&amp;amp; Data[Factor B] &amp;lt;&amp;gt; "Yes",
            Data[Action] = "Jumping jacks",
                Data[Evaluation] &amp;lt;&amp;gt; "Bad"
                    &amp;amp;&amp;amp; OR ( Data[Factor A] = "Yes", Data[Factor B] = "Yes" )
        )
    ),
    Data[Duration (minutes)]
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Jun 2022 03:22:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2605524#M75424</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-06-28T03:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE conditional filters for specific circumstances</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2607092#M75505</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 13:34:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-conditional-filters-for-specific-circumstances/m-p/2607092#M75505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-28T13:34:07Z</dc:date>
    </item>
  </channel>
</rss>

