<?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: Need measure to calculate if last year's week number equals this year's week number in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533752#M30123</link>
    <description>&lt;P&gt;This worked perfectly!&amp;nbsp; Thanks for the solution.&amp;nbsp; I actually used this for a separate measure to pull the week prior to max.&amp;nbsp; What was odd is I had to use MAX (data[Week]) - 10 to accomplish that.&amp;nbsp; Logically I would expect to be able to use MAX(data[week]) -1 but it continued to show data from the max week.&amp;nbsp; My week column is data time whole number so I couldn't figure out why -10 worked but I'll take what I can get.&amp;nbsp; Thanks again for your help!&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2020 22:04:02 GMT</pubDate>
    <dc:creator>jdwalker5</dc:creator>
    <dc:date>2020-12-04T22:04:02Z</dc:date>
    <item>
      <title>Need measure to calculate if last year's week number equals this year's week number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1521403#M29671</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just learning how to use custom DAX code to create measures in Power BI.&amp;nbsp; I'm trying to create a simple table visual using measures that calcualte and compare this year's results to last year's where the week numbers match.&amp;nbsp; My data already has a week number column that corresponds with my company's fiscal year so I do not need to use a date column.&amp;nbsp; Creating the measures for this year were easy because the data is limited to the current week.&amp;nbsp; In other words, the data source doesn't contain any data for dates beyond the current week that we're in now.&amp;nbsp; So for 2020 data, I created a measure for max week and called it current week.&amp;nbsp; Now I need to create a measure to pull last year's data for that same week number so that I can compare results year over year.&amp;nbsp; I cannot use max for last year's data because it has all 53 weeks.&lt;/P&gt;&lt;P&gt;This is basically how I would like to present the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;YoY Comparision&lt;/TD&gt;&lt;TD&gt;Week 40 This Year&lt;/TD&gt;&lt;TD&gt;Week 40 Last Year&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Products Sold&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;85&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, my data has a week number column.&amp;nbsp; I just need to find a way to get last year's data for the same week as this year's current week.&amp;nbsp; Any help is very much appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 19:13:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1521403#M29671</guid>
      <dc:creator>jdwalker5</dc:creator>
      <dc:date>2020-11-27T19:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need measure to calculate if last year's week number equals this year's week number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1521431#M29674</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269285" data-lia-user-login="jdwalker5" class="lia-mention lia-mention-user"&gt;jdwalker5&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So does your data have a year column?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here is a quick table to show proof of concept.&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;The measure&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last Year Product Same Week =
VAR PastYear =
    MAX ( Data[Year] ) - 1
VAR CurrentWeek =
    MAX ( Data[Week] )
VAR _calc =
    CALCULATE (
        MAX ( Data[ProductSold] ),
        Data[Year] = PastYear,
        Data[Week] = CurrentWeek
    )
RETURN
    _calc
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;The result&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 19:54:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1521431#M29674</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2020-11-27T19:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need measure to calculate if last year's week number equals this year's week number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533722#M30120</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269285" data-lia-user-login="jdwalker5" class="lia-mention lia-mention-user"&gt;jdwalker5&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;If this solves your issue, please mark it so others can find it more easily!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 21:20:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533722#M30120</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2020-12-04T21:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need measure to calculate if last year's week number equals this year's week number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533752#M30123</link>
      <description>&lt;P&gt;This worked perfectly!&amp;nbsp; Thanks for the solution.&amp;nbsp; I actually used this for a separate measure to pull the week prior to max.&amp;nbsp; What was odd is I had to use MAX (data[Week]) - 10 to accomplish that.&amp;nbsp; Logically I would expect to be able to use MAX(data[week]) -1 but it continued to show data from the max week.&amp;nbsp; My week column is data time whole number so I couldn't figure out why -10 worked but I'll take what I can get.&amp;nbsp; Thanks again for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 22:04:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533752#M30123</guid>
      <dc:creator>jdwalker5</dc:creator>
      <dc:date>2020-12-04T22:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need measure to calculate if last year's week number equals this year's week number</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533763#M30124</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="269285" data-lia-user-login="jdwalker5" class="lia-mention lia-mention-user"&gt;jdwalker5&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;You are very welcome!&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 22:13:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-measure-to-calculate-if-last-year-s-week-number-equals-this/m-p/1533763#M30124</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2020-12-04T22:13:24Z</dc:date>
    </item>
  </channel>
</rss>

