<?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 Trying to get a week to date # but last year sales goes away in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2575988#M73760</link>
    <description>&lt;P&gt;I have a measure to get the current yr in a calculated date table&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This Year = IF('Date'[Date].[Year] = MAX('Date'[Date].[Year]), "This Year", FORMAT('Date'[Date].[Year], "####"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I have a week measure in our retail calendar (adjusts for retail weeks) that I use to match same week and year&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This week w. leap = 
IF('DIM_Calendar_From_2010_To_2100'[Week Number] = WEEKNUM(MAX('Date'[Date]),1)-1,"This Week",
    FORMAT('DIM_Calendar_From_2010_To_2100'[Week Number],"##"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this works fine at the end of the week, but during the current week, the last year sales are fully calculated, and this week's sales only has 1 day or too. Is there a way to have last year show only up to the days this year sales shows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried putting my week filter in the calculated date table, but it calculated a day prior to what it's supposed to be compared to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to tweak the week column in my retail table to only get the max date, but then this year sales don't show&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(DIM_Calendar_From_2010_To_2100[TheDate] = MAX('date'[date]) &amp;amp;&amp;amp;
    'DIM_Calendar_From_2010_To_2100'[Week Number] = WEEKNUM(MAX('Date'[Date]),1)-1,"This Week",
    FORMAT('DIM_Calendar_From_2010_To_2100'[Week Number],"##")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2022 19:23:45 GMT</pubDate>
    <dc:creator>OCBB_SFAFPandA</dc:creator>
    <dc:date>2022-06-13T19:23:45Z</dc:date>
    <item>
      <title>Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2575988#M73760</link>
      <description>&lt;P&gt;I have a measure to get the current yr in a calculated date table&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This Year = IF('Date'[Date].[Year] = MAX('Date'[Date].[Year]), "This Year", FORMAT('Date'[Date].[Year], "####"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I have a week measure in our retail calendar (adjusts for retail weeks) that I use to match same week and year&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;This week w. leap = 
IF('DIM_Calendar_From_2010_To_2100'[Week Number] = WEEKNUM(MAX('Date'[Date]),1)-1,"This Week",
    FORMAT('DIM_Calendar_From_2010_To_2100'[Week Number],"##"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this works fine at the end of the week, but during the current week, the last year sales are fully calculated, and this week's sales only has 1 day or too. Is there a way to have last year show only up to the days this year sales shows?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried putting my week filter in the calculated date table, but it calculated a day prior to what it's supposed to be compared to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to tweak the week column in my retail table to only get the max date, but then this year sales don't show&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(DIM_Calendar_From_2010_To_2100[TheDate] = MAX('date'[date]) &amp;amp;&amp;amp;
    'DIM_Calendar_From_2010_To_2100'[Week Number] = WEEKNUM(MAX('Date'[Date]),1)-1,"This Week",
    FORMAT('DIM_Calendar_From_2010_To_2100'[Week Number],"##")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 19:23:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2575988#M73760</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-13T19:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2578142#M73886</link>
      <description>&lt;P&gt;My code is up to this point, but it is filtering out any prior year current weeks. I tried a function to equal todays' year, but then my last year sales numbers don't show up.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	IF(
        DIM_Calendar_From_2010_To_2100[TheDayOfWeek] &amp;lt;= weekday(MAX('date'[date]),1) &amp;amp;&amp;amp;
	    'DIM_Calendar_From_2010_To_2100'[Week Number] = WEEKNUM(MAX('Date'[Date]),1)-1,"This Week",
    FORMAT('DIM_Calendar_From_2010_To_2100'[Week Number],"##"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 16:03:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2578142#M73886</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-14T16:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2582573#M74149</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388250" data-lia-user-login="OCBB_SFAFPandA" class="lia-mention lia-mention-user"&gt;OCBB_SFAFPandA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get the same days in the last year week as current week days from begining to today? For example, today is Tuesday and weeknum 25, the date range should be Sunday to Tuesday in week 25 of last year?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;If this week =
VAR _max =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        AND (
            DIM_Calendar_From_2010_To_2100[TheDayOfWeek] &amp;lt;= WEEKDAY ( _max, 1 )
                &amp;amp;&amp;amp; 'DIM_Calendar_From_2010_To_2100'[Week Number]
                    = WEEKNUM ( _max, 1 ) - 1,
            'DIM_Calendar_From_2010_To_2100'[Date] &amp;lt;= _max
        ),
        "This week",
        FORMAT ( 'DIM_Calendar_From_2010_To_2100'[Week Number], "00" )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 08:59:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2582573#M74149</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-16T08:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2583629#M74224</link>
      <description>&lt;P&gt;Thanks for your reply.&amp;nbsp; Yes, that's correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My page is set up like this&lt;/P&gt;&lt;P&gt;Slicer for Year and week&lt;BR /&gt;Table&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Location&lt;/TD&gt;&lt;TD&gt;Sales this year&lt;/TD&gt;&lt;TD&gt;Last year&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;$150&lt;/TD&gt;&lt;TD&gt;$100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;right now I have a measure that grabs the WTD (in your example, Sun-Tues) and returns a sales amount. The problem is that in the table last year sales shows the full week (Sun-Sat).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried another measure that puts the current year in the formula, but then last year sales totals doesn't show in the tables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 16:01:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2583629#M74224</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-16T16:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2583919#M74242</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 19:13:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2583919#M74242</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-16T19:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a week to date # but last year sales goes away</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2586238#M74383</link>
      <description>&lt;P&gt;Think I got it, it was an issue with LY sales using sameperiodlast year and my filters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Able to get it with this link&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="How to Compare Sales With Last Year on Day in Week in Power BI" href="https://summalai.com/?p=4036" target="_self"&gt;https://summalai.com/?p=4036&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 18:16:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Trying-to-get-a-week-to-date-but-last-year-sales-goes-away/m-p/2586238#M74383</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-17T18:16:50Z</dc:date>
    </item>
  </channel>
</rss>

