<?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 Group previous years based on selected year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-previous-years-based-on-selected-year/m-p/3731526#M145419</link>
    <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to summarise / group by years in a table based on a selected year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have data for 2020, 2021, 2022 and 2023.&lt;/P&gt;&lt;P&gt;Three columns voucher, date and amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I select 2023 I would like to show the 2023 vouchers in detail (with voucher and date) and at the top the summary of the previous year (one row, only the amount).&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2024 19:39:04 GMT</pubDate>
    <dc:creator>marcvd</dc:creator>
    <dc:date>2024-02-28T19:39:04Z</dc:date>
    <item>
      <title>Group previous years based on selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-previous-years-based-on-selected-year/m-p/3731526#M145419</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to summarise / group by years in a table based on a selected year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have data for 2020, 2021, 2022 and 2023.&lt;/P&gt;&lt;P&gt;Three columns voucher, date and amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I select 2023 I would like to show the 2023 vouchers in detail (with voucher and date) and at the top the summary of the previous year (one row, only the amount).&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 19:39:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-previous-years-based-on-selected-year/m-p/3731526#M145419</guid>
      <dc:creator>marcvd</dc:creator>
      <dc:date>2024-02-28T19:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Group previous years based on selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-previous-years-based-on-selected-year/m-p/3732459#M145460</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="274774" data-lia-user-login="marcvd" class="lia-mention lia-mention-user"&gt;marcvd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based your infomation, I create a table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try using DAX with visuals. If we don't have a Year column, we can create a Year column first, and then put the new column into the slicer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Year = YEAR('Table'[Date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a Measure called Previous Year Summary and put it in the card visual to show the total revenue for the previous year for the selected year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;DAX:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Previous Year Summary = 
CALCULATE(
    SUM('Table'[Amount]), 
    FILTER(
        ALL('Table'), 
        'Table'[Year] &amp;lt; MAX('Table'[Year])&amp;amp;&amp;amp; YEAR('Table'[date]) = YEAR(MIN('Table'[date])) - 1
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then put all the information of the voucher into another table. Here's my preview:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 6.0pt 0cm 0cm 0cm;"&gt;&lt;SPAN&gt;&lt;A title="https://community.powerbi.com/t5/community-blog/how-to-get-your-question-answered-quickly/ba-p/38490" href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C02%7Cv-yohua%40microsoft.com%7Ce1106bfabecb4734a5cc08dc2305bc51%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638423754744679080%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;amp;sdata=24%2BceC5sFd3n3%2FhFDYILWFcNjCwVClBD%2BPBsSLVfJGk%3D&amp;amp;reserved=0" target="_blank" rel="noopener"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 6.0pt 0cm 0cm 0cm;"&gt;&lt;SPAN&gt;If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Yongkang Hua&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 06:07:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Group-previous-years-based-on-selected-year/m-p/3732459#M145460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-29T06:07:35Z</dc:date>
    </item>
  </channel>
</rss>

