<?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: DAX - SUM IF Query in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320563#M57954</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236375" data-lia-user-login="SuperCal99" class="lia-mention lia-mention-user"&gt;SuperCal99&lt;/a&gt;&amp;nbsp;You should be able to use SUMX or CALCULATE to do this like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
  VAR __2022 = CALCULATE(SUM([London]),[year] = 2022, [statecodename] = "active")
  VAR __2023 = CALCULATE(SUM([London]),[year] = 2023, [statecodename] = "inactive")
  VAR __2024 = CALCULATE(SUM([London]),[year] = 2024, [statecodename] = "inactive")
RETURN
  __2022 + __2023 + __2024

or

Measure =
  VAR __2022 = SUMX(FILTER('Table',[year] = 2022 &amp;amp;&amp;amp; [statecodename] = "active"),[London])
  VAR __2023 = SUMX(FILTER('Table',[year] = 2023 &amp;amp;&amp;amp; [statecodename] = "inactive"),[London])
  VAR __2024 = SUMX(FILTER('Table',[year] = 2024 &amp;amp;&amp;amp; [statecodename] = "inactive"),[London])
RETURN
  __2022 + __2023 + __2024&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 04 Feb 2022 19:43:59 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2022-02-04T19:43:59Z</dc:date>
    <item>
      <title>DAX - SUM IF Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320557#M57952</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table visual which i am trying to create a dax measure for.&lt;/P&gt;&lt;P&gt;Basically I have the below table. I want to sum the values in&amp;nbsp; [London] if:&lt;BR /&gt;&lt;BR /&gt;[year] is 2022 and [statecodename] is active&lt;BR /&gt;[year] is 2023 and [statecodename] is inactive&lt;BR /&gt;[year] is 2024 and [statecodename] is inactive&lt;BR /&gt;&lt;BR /&gt;So when i use my year filter , the table visual will update the sums based on the year selected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that makes sense, please let me know if you need any further info&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cal&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 19:40:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320557#M57952</guid>
      <dc:creator>SuperCal99</dc:creator>
      <dc:date>2022-02-04T19:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - SUM IF Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320563#M57954</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236375" data-lia-user-login="SuperCal99" class="lia-mention lia-mention-user"&gt;SuperCal99&lt;/a&gt;&amp;nbsp;You should be able to use SUMX or CALCULATE to do this like:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
  VAR __2022 = CALCULATE(SUM([London]),[year] = 2022, [statecodename] = "active")
  VAR __2023 = CALCULATE(SUM([London]),[year] = 2023, [statecodename] = "inactive")
  VAR __2024 = CALCULATE(SUM([London]),[year] = 2024, [statecodename] = "inactive")
RETURN
  __2022 + __2023 + __2024

or

Measure =
  VAR __2022 = SUMX(FILTER('Table',[year] = 2022 &amp;amp;&amp;amp; [statecodename] = "active"),[London])
  VAR __2023 = SUMX(FILTER('Table',[year] = 2023 &amp;amp;&amp;amp; [statecodename] = "inactive"),[London])
  VAR __2024 = SUMX(FILTER('Table',[year] = 2024 &amp;amp;&amp;amp; [statecodename] = "inactive"),[London])
RETURN
  __2022 + __2023 + __2024&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Feb 2022 19:43:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320563#M57954</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-02-04T19:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: DAX - SUM IF Query</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320585#M57955</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;, perfection&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 19:55:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-SUM-IF-Query/m-p/2320585#M57955</guid>
      <dc:creator>SuperCal99</dc:creator>
      <dc:date>2022-02-04T19:55:20Z</dc:date>
    </item>
  </channel>
</rss>

