<?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: Date for Last two Friday's Dax in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033382#M45617</link>
    <description>&lt;P&gt;Happy to have helped. &lt;BR /&gt;BTW, if you have date fields in your model you should be using the Calendar table as a dimension table by creating relationships with the corresponding date fields in your model. You can the use Time Intelligence functions in measures, and the fields from the Calendar table in your visuals, filters, slicers, measures etc&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2021 21:29:36 GMT</pubDate>
    <dc:creator>PaulDBrown</dc:creator>
    <dc:date>2021-08-23T21:29:36Z</dc:date>
    <item>
      <title>Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032864#M45595</link>
      <description>&lt;P class="lia-align-left"&gt;Hi&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For this week (today 23th august 2021) - I want to display two dates i.e last two fridays&lt;BR /&gt;1) Last Friday &lt;STRONG&gt;i.e 08/20/2021&lt;/STRONG&gt;&lt;BR /&gt;2) Last Friday before 20th August,2021&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;i.e 08/13/2021&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Can someone please help me with the DAX?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 16:37:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032864#M45595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-23T16:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032931#M45597</link>
      <description>&lt;P&gt;do you have a Calendar or Date table? Also, does the week begin on Sunday or Monday?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 16:57:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032931#M45597</guid>
      <dc:creator>PaulDBrown</dc:creator>
      <dc:date>2021-08-23T16:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032960#M45598</link>
      <description>&lt;P&gt;I dont have a calendar nor date table. But I can definately create on based on your suggestion.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 17:06:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032960#M45598</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-23T17:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032971#M45599</link>
      <description>&lt;P&gt;you need one. Also, does the week start on Sunday or Monday?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 17:09:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2032971#M45599</guid>
      <dc:creator>PaulDBrown</dc:creator>
      <dc:date>2021-08-23T17:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033179#M45605</link>
      <description>&lt;P&gt;Anything would work. As far as I get to the friday's date&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 18:52:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033179#M45605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-23T18:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033188#M45606</link>
      <description>&lt;P&gt;OK. First create a Calendar Table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;Calendar Table =
VAR MinD =
    DATE ( 2020, 12, 01 ) // subsitute for the expression for the minimum date in you model, as in MIN(Table1[Date])
VAR MaxD =
    DATE ( 2021, 10, 31 ) // subsitute for the expression for the maximum date in you model, as in MAX(Table2[Date]) - if the min and max dates are in the same table, use the same table expression.
RETURN
    ADDCOLUMNS (
        CALENDAR ( MinD, MaxD ),
        "WeekDay", WEEKDAY ( [Date], 2 ),
        "WeekNum", WEEKNUM ( [Date] ),
        "Year", YEAR ( [Date] ),
        "YearWeek",
            YEAR ( [Date] ) * 100
                + WEEKNUM ( [Date] )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add a new calculated column to this table to establish an index for the YearWeek field using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;Index =
RANKX('Calendar Table', 'Calendar Table'[YearWeek],,ASC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you should get this final Calendar Table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now create the measure you need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;Last Friday =
VAR YearWeek =
    CALCULATE (
        MAX ( 'Calendar Table'[Index] ),
        FILTER ( 'Calendar Table' , 'Calendar Table'[Date] = TODAY () )
    )
RETURN
    CALCULATE (
        MAX ( 'Calendar Table'[Date] ),
        FILTER (
            'Calendar Table',
            'Calendar Table'[Index] = YearWeek - 1
                &amp;amp;&amp;amp; 'Calendar Table'[WeekDay] = 5
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;2 Friday Ago =
VAR YearWeek =
    CALCULATE (
        MAX ( 'Calendar Table'[Index] ),
        FILTER ( 'Calendar Table' , 'Calendar Table'[Date] = TODAY () )
    )
RETURN
    CALCULATE (
        MAX ( 'Calendar Table'[Date] ),
        FILTER (
            'Calendar Table',
            'Calendar Table'[Index] = YearWeek - 2
                &amp;amp;&amp;amp; 'Calendar Table'[WeekDay] = 5
        )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you will get this:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 07:51:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033188#M45606</guid>
      <dc:creator>PaulDBrown</dc:creator>
      <dc:date>2021-08-24T07:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033337#M45613</link>
      <description>&lt;P&gt;Thank you. This is super-helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 21:07:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033337#M45613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-23T21:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Date for Last two Friday's Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033382#M45617</link>
      <description>&lt;P&gt;Happy to have helped. &lt;BR /&gt;BTW, if you have date fields in your model you should be using the Calendar table as a dimension table by creating relationships with the corresponding date fields in your model. You can the use Time Intelligence functions in measures, and the fields from the Calendar table in your visuals, filters, slicers, measures etc&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 21:29:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-for-Last-two-Friday-s-Dax/m-p/2033382#M45617</guid>
      <dc:creator>PaulDBrown</dc:creator>
      <dc:date>2021-08-23T21:29:36Z</dc:date>
    </item>
  </channel>
</rss>

