<?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: How to find Latest and 2nd Latest Read of each month? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326463#M23411</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- Maybe:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Latest =
  VAR __LatestDate = MAXX('Table',[Date])
RETURN
  MAXX(FILTER('Table',[Date]=__LatestDate),[Read])

2nd Latest =
  VAR __LatestDate = MAXX('Table',[Date])
  VAR __2ndLatest = MAXX(FILTER('Table',[Date]&amp;lt;&amp;gt;__LatestDate),[Date])
RETURN
  MAXX(FILTER('Table',[Date]=__2ndLatest),[Read])
&lt;/LI-CODE&gt;
&lt;P&gt;Basically variations of Lookup Min/Max -&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Aug 2020 16:27:00 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-08-26T16:27:00Z</dc:date>
    <item>
      <title>How to find Latest and 2nd Latest Read of each month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326434#M23408</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here is my data sample,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want to create a table that looks like this&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to get the month and the Last &lt;SPAN&gt;Read&lt;/SPAN&gt;, but was not able to get the 2nd last&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX that I have used:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1)&lt;BR /&gt;Last date = MAX('Consumption (2)'[Adjusted Read Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;2)&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Previous Read = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(MAX('Consumption (2)'[Read]),&lt;BR /&gt;FILTER(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALL('Consumption (2)'[Adjusted Read Date]), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Consumption (2)'[Adjusted Read Date] &amp;lt; [Last date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Aug 2020 16:11:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326434#M23408</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-26T16:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to find Latest and 2nd Latest Read of each month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326461#M23410</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , one way is to create&amp;nbsp; rank column on date inside moth and use that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Rank Refer these links&lt;BR /&gt;&lt;A href="https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures" target="_blank"&gt;https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns" target="_blank"&gt;https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale" target="_blank"&gt;https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or try these measures&lt;/P&gt;
&lt;P&gt;last value = CALCULATE(lastnonblankvalue(Table[Date],max(Table[Read])),DATESMTD('Date'[Date]))&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;second last value = &lt;BR /&gt;var _max = CALCULATE(max(Table[Date]),DATESMTD('Date'[Date]))&lt;BR /&gt;return &lt;BR /&gt;CALCULATE(lastnonblankvalue(Table[Date],max(Table[Read])),DATESMTD('Date'[Date]), filter(Date, Date[Date]&amp;lt;_max))&lt;/P&gt;
&lt;P&gt;or&lt;BR /&gt;second last value = &lt;BR /&gt;var _max = CALCULATE(max(Table[Date]),DATESMTD('Date'[Date]))&lt;BR /&gt;return &lt;BR /&gt;CALCULATE(lastnonblankvalue(Table[Date],max(Table[Read])),DATESMTD('Date'[Date]), filter(Table, Table[Date]&amp;lt;_max))&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 16:26:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326461#M23410</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-26T16:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find Latest and 2nd Latest Read of each month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326463#M23411</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- Maybe:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Latest =
  VAR __LatestDate = MAXX('Table',[Date])
RETURN
  MAXX(FILTER('Table',[Date]=__LatestDate),[Read])

2nd Latest =
  VAR __LatestDate = MAXX('Table',[Date])
  VAR __2ndLatest = MAXX(FILTER('Table',[Date]&amp;lt;&amp;gt;__LatestDate),[Date])
RETURN
  MAXX(FILTER('Table',[Date]=__2ndLatest),[Read])
&lt;/LI-CODE&gt;
&lt;P&gt;Basically variations of Lookup Min/Max -&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 16:27:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-find-Latest-and-2nd-Latest-Read-of-each-month/m-p/1326463#M23411</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-08-26T16:27:00Z</dc:date>
    </item>
  </channel>
</rss>

