<?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 Get records from current &amp;amp; previous year, when only current year selected in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058175#M105576</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate it so much if you can help me here please.&lt;/P&gt;&lt;P&gt;I would like to select a year from a slicer, but the records from the Selected year &amp;amp; records from Previous year to be shown. How can I achieve something like that?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 15:04:22 GMT</pubDate>
    <dc:creator>y5famfnatudu</dc:creator>
    <dc:date>2023-02-02T15:04:22Z</dc:date>
    <item>
      <title>Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058175#M105576</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate it so much if you can help me here please.&lt;/P&gt;&lt;P&gt;I would like to select a year from a slicer, but the records from the Selected year &amp;amp; records from Previous year to be shown. How can I achieve something like that?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 15:04:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058175#M105576</guid>
      <dc:creator>y5famfnatudu</dc:creator>
      <dc:date>2023-02-02T15:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058207#M105579</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="394849" data-lia-user-login="y5famfnatudu" class="lia-mention lia-mention-user"&gt;y5famfnatudu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can try like:&lt;/P&gt;&lt;P&gt;Measure =&lt;/P&gt;&lt;P&gt;CALCULATE([...], EDATE(TableName[Date], -12))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or if you have dedicated date table, try Time Intelligence functions, like:&lt;/P&gt;&lt;P&gt;CALCULATE([...], DATEADD(TableName[Date], -1, YEAR))&lt;/P&gt;&lt;P&gt;CALCULATE([...], SAMEPERIODLASTYEAR(TableName[Date]))&lt;/P&gt;&lt;P&gt;and many more.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 15:16:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058207#M105579</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-02T15:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058465#M105593</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I don't need measures to calculate anything, I just need a table visual to show the records belonging to the selected year &amp;amp; previous year, as shown in the screenshot above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 16:42:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3058465#M105593</guid>
      <dc:creator>y5famfnatudu</dc:creator>
      <dc:date>2023-02-02T16:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059290#M105631</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="394849" data-lia-user-login="y5famfnatudu" class="lia-mention lia-mention-user"&gt;y5famfnatudu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;supposing you have two unrelated tables like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) plot a table visual with all the columns from the first table, choose "don't summarize" for every column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) write a measure like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YearFilter = 
VAR _year = SELECTEDVALUE(Year[Year])
RETURN
IF(
    YEAR(MAX(TableName[OrderDate])) IN {_year, _year-1},
    1,0
 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp;feed the measure to the filter pane for the table visual and choose 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it worked like this:&lt;/P&gt;&lt;P&gt;&lt;img /&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, 03 Feb 2023 02:01:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059290#M105631</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-03T02:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059616#M105652</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this didn't work for me, as the Date Table is realted to Orders, and other tables in the dashboard.&lt;/P&gt;&lt;P&gt;Do you think it's still possible to tweak the measure please so that it shows the selected year and the previous one? Your help is so much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:12:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059616#M105652</guid>
      <dc:creator>y5famfnatudu</dc:creator>
      <dc:date>2023-02-03T06:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get records from current &amp; previous year, when only current year selected</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059694#M105655</link>
      <description>&lt;P&gt;hi&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="394849" data-lia-user-login="y5famfnatudu" class="lia-mention lia-mention-user"&gt;y5famfnatudu&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The measue could be tweaked to ignore the slicer, but you still have orderdate columns, which are anyway filtered by the Year slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in cases like this, try to create an small independent table for the year slicer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may import one from excel, create one from Power Query Editor, or with DAX code like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Year =
SELECTCOLUMNS(
    {2022, 2023},
    "Year", [Value]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:46:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-records-from-current-amp-previous-year-when-only-current/m-p/3059694#M105655</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-03T06:46:38Z</dc:date>
    </item>
  </channel>
</rss>

