<?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: previous week calculation repeating over empty dates weekly to daily relationship in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2959636#M98489</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, this option is available only for superusers and community service&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Dec 2022 17:36:17 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-12-09T17:36:17Z</dc:date>
    <item>
      <title>previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2955238#M98160</link>
      <description>&lt;P&gt;I have the below data model.&lt;/P&gt;&lt;P&gt;Where the fact table is weekly and calendar is daily.&lt;/P&gt;&lt;P&gt;When I calculate the previous week value it adds all the dates from the calendar rathen than keeping only dates in the fact table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PREVIOUSWEEK Value WDT = 
VAR _Today =
    SELECTEDVALUE(Lookup_Calendar[Date])
VAR _WOT =
    WEEKNUM( _Today, 1 ) -- Number 2 determines that the week begins on Monday.
VAR _LW = _WOT - 1
RETURN
    CALCULATE(
        SUM( Data[Units]),
        FILTER(
            ALLSELECTED( Lookup_Calendar ),
            Lookup_Calendar[Week Of Year] = _LW
                &amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR(_Today )
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="pbix file" href="https://drive.google.com/file/d/1zQytXPHa0KuheqQr4fYUJpuim-MK77-_/view?usp=sharing" target="_self"&gt;pbixfile&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 00:41:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2955238#M98160</guid>
      <dc:creator>datacode</dc:creator>
      <dc:date>2022-12-09T00:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2955492#M98172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;PREVIOUSWEEK Value WDT =&lt;BR /&gt;VAR _Today =&lt;BR /&gt;SELECTEDVALUE ( Lookup_Calendar[Date] )&lt;BR /&gt;VAR _WOT =&lt;BR /&gt;WEEKNUM ( _Today, 1 ) -- Number 2 determines that the week begins on Monday.&lt;BR /&gt;VAR _LW = _WOT - 1&lt;BR /&gt;VAR SelectedDates =&lt;BR /&gt;CALCULATETABLE (&lt;BR /&gt;ALLSELECTED ( Lookup_Calendar ),&lt;BR /&gt;CROSSFILTER ( Lookup_Calendar[Date], Data[Date], BOTH )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( Data[Units] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;SelectedDates,&lt;BR /&gt;Lookup_Calendar[Week Of Year] = _LW&lt;BR /&gt;&amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR ( _Today )&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 03:28:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2955492#M98172</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-08T03:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957363#M98297</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for your response and taking the time. I thought this would of work it was a good idea.&lt;/P&gt;&lt;P&gt;Unfortunately, I am still receiving the same output. I find it strange this is not been filtered out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PREVIOUSWEEK Value WDT = 
VAR _Today =
SELECTEDVALUE ( Lookup_Calendar[Date] )
VAR _WOT =
WEEKNUM ( _Today, 1 ) -- Number 2 determines that the week begins on Monday.
VAR _LW = _WOT - 1
VAR SelectedDates =
CALCULATETABLE (
ALLSELECTED ( Lookup_Calendar ),
CROSSFILTER ( Lookup_Calendar[Date], Data[Date], Both)
)
RETURN
CALCULATE (
SUM ( Data[Units] ),
FILTER (
SelectedDates,
Lookup_Calendar[Week Of Year] = _LW
&amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR ( _Today )
)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:20:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957363#M98297</guid>
      <dc:creator>datacode</dc:creator>
      <dc:date>2022-12-08T17:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957456#M98305</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting. It seems that I don't understand this behavior &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;however please try&lt;/P&gt;
&lt;P&gt;PREVIOUSWEEK Value WDT =&lt;BR /&gt;VAR _Today =&lt;BR /&gt;SELECTEDVALUE ( Lookup_Calendar[Date] )&lt;BR /&gt;VAR _WOT =&lt;BR /&gt;WEEKNUM ( _Today, 1 ) -- Number 2 determines that the week begins on Monday.&lt;BR /&gt;VAR _LW = _WOT - 1&lt;BR /&gt;VAR DatesWthData =&lt;BR /&gt;ALL ( Data[Date] )&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( Data[Units] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALLSELECTED ( Lookup_Calendar ),&lt;BR /&gt;Lookup_Calendar[Week Of Year] = _LW&lt;BR /&gt;&amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR ( _Today )&lt;BR /&gt;&amp;amp;&amp;amp; Lookup_Calendar[Date] IN DatesWthData&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;*EDIT&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;In general ALLSELECTED as a table function can be complex and sometimes it's difficult to understand its behaviour. It also could be just as simple as&lt;/P&gt;
&lt;P&gt;PREVIOUSWEEK Value WDT =&lt;BR /&gt;VAR _Today =&lt;BR /&gt;SELECTEDVALUE ( Lookup_Calendar[Date] )&lt;BR /&gt;VAR _WOT =&lt;BR /&gt;WEEKNUM ( _Today, 1 ) -- Number 2 determines that the week begins on Monday.&lt;BR /&gt;VAR _LW = _WOT - 1&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( Data[Units] ),&lt;BR /&gt;ALLSELECTED ( Lookup_Calendar ),&lt;BR /&gt;Lookup_Calendar[Week Of Year] = _LW&lt;BR /&gt;&amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR ( _Today )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 18:20:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957456#M98305</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-08T18:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957482#M98306</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you again for sharing updated recommondations. I gave this a try and I have still the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I thought I understood it too, but I am not sure what could be the issue.&lt;/P&gt;&lt;P&gt;I was thinking the issue was the frequency of the data because the calculation is done over a weekly data and not daily.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 18:36:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957482#M98306</guid>
      <dc:creator>datacode</dc:creator>
      <dc:date>2022-12-08T18:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957574#M98315</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is a sample file can you share it? Or otherwise, can you create a similar sample file that simulates the issue and share it with me?&lt;/P&gt;
&lt;P&gt;thsnk you&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 19:41:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957574#M98315</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-08T19:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957814#M98338</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have edited the post to a pbix file sample with the same issue.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 00:42:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2957814#M98338</guid>
      <dc:creator>datacode</dc:creator>
      <dc:date>2022-12-09T00:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2958536#M98392</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Ok, that was stupidly simple. The SELECTEDVALUE ( &lt;SPAN&gt;Lookup_Calendar[Date] ) has a value in each single date which forces the engine to display the values for all dates. &lt;SPAN&gt;This is supposed to be&amp;nbsp;SELECTEDVALUE ( Data[Date] ). Please refer to attached sample file.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;PREVIOUSWEEK Value WDT = 
VAR _Today =
    SELECTEDVALUE(Data[Date])
VAR _WOT =
    WEEKNUM( _Today, 1 ) -- Number 2 determines that the week begins on Monday.
VAR _LW = _WOT - 1
VAR Result =
    CALCULATE(
        SUM( Data[Units]),
        FILTER(
            ALLSELECTED( Lookup_Calendar ),
            Lookup_Calendar[Week Of Year] = _LW
                &amp;amp;&amp;amp; Lookup_Calendar[Year] = YEAR(_Today )
        )
    )
RETURN
    Result&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Dec 2022 08:59:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2958536#M98392</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-09T08:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2959531#M98475</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;So you are so helpful thank you so much for your help this worked!!!&lt;/P&gt;&lt;P&gt;Question what option do you use to insert the pbix file without going to an external link?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 16:22:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2959531#M98475</guid>
      <dc:creator>datacode</dc:creator>
      <dc:date>2022-12-09T16:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: previous week calculation repeating over empty dates weekly to daily relationship</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2959636#M98489</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="483559" data-lia-user-login="datacode" class="lia-mention lia-mention-user"&gt;datacode&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, this option is available only for superusers and community service&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 17:36:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/previous-week-calculation-repeating-over-empty-dates-weekly-to/m-p/2959636#M98489</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-09T17:36:17Z</dc:date>
    </item>
  </channel>
</rss>

