<?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: Summing two years as a single year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2277278#M55612</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , sum of two columns in not a problem&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can select a five year range on page or can control year in measure&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume date in the table is joined with data of date and no date filter on page&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;var _max = year(maxx(allselected('Date'), 'Date'[Date]))&lt;/P&gt;
&lt;P&gt;var _min =_max -5&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[A]) + sum(Table[B]), filter('date', 'date'[Year] &amp;gt;=_min &amp;amp;&amp;amp; 'Date'[Year] &amp;lt;=_max) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this does not help&lt;BR /&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jan 2022 10:19:35 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-01-11T10:19:35Z</dc:date>
    <item>
      <title>Summing two years as a single year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2277212#M55610</link>
      <description>&lt;P&gt;Hi, I have a pretty complex issue that I am working on and I am wondering if PowerBI has the capability to do this.&lt;BR /&gt;&lt;BR /&gt;I am calculating energy savings from energy conservation projects, where I need to sum the one column from this year, and another column from last year. For example, the total 2020 savings would be (column A total in 2019) plus (column B total in 2020).&lt;BR /&gt;&lt;BR /&gt;Every attempt I have made has resulted in (A in 2019 + B in 2019) and (A in 2020 + B in 2020) when I try to add the year field to my chart.&lt;BR /&gt;&lt;BR /&gt;I have a large calendar table which has year offsets etc but I can't figure out a way to make use of that for this task.&lt;BR /&gt;&lt;BR /&gt;If anybody has some ideas I could try that would be amazing.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 10:14:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2277212#M55610</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-11T10:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Summing two years as a single year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2277278#M55612</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , sum of two columns in not a problem&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can select a five year range on page or can control year in measure&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume date in the table is joined with data of date and no date filter on page&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure =&lt;/P&gt;
&lt;P&gt;var _max = year(maxx(allselected('Date'), 'Date'[Date]))&lt;/P&gt;
&lt;P&gt;var _min =_max -5&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[A]) + sum(Table[B]), filter('date', 'date'[Year] &amp;gt;=_min &amp;amp;&amp;amp; 'Date'[Year] &amp;lt;=_max) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this does not help&lt;BR /&gt;Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 10:19:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2277278#M55612</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-01-11T10:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Summing two years as a single year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2283048#M55898</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;;&lt;/P&gt;
&lt;P&gt;You could create a measure such as:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE(SUM([A]),FILTER('Table',YEAR([Date])=2019))+CALCULATE(SUM([B]),FILTER('Table',YEAR([Date])=2020))&lt;/LI-CODE&gt;
&lt;P&gt;The final output is shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the problem is still not resolved, please provide&amp;nbsp; the expected result you expect. Let me know immediately, looking forward to your reply.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Community Support Team_ Yalan Wu&lt;BR /&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 05:38:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Summing-two-years-as-a-single-year/m-p/2283048#M55898</guid>
      <dc:creator>v-yalanwu-msft</dc:creator>
      <dc:date>2022-01-14T05:38:02Z</dc:date>
    </item>
  </channel>
</rss>

