<?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: Filter Latest Quarter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965860#M43081</link>
    <description>&lt;P&gt;Thanks again! Worked perfectly. I'm fairly new to DAX so it will take me a while to fully understand it.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jul 2021 12:39:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-07-19T12:39:39Z</dc:date>
    <item>
      <title>Filter Latest Quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1962176#M42929</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies if this has been answered in another post. I have searched but cannot find the answer I'm looking for.&lt;/P&gt;&lt;P&gt;I'm trying to create a measure to show the sum a value for the latest quarter in the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have a measure to sum the column I'm interested in&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rebate Sum =
SUM ( vwEdoxabanRebateByCCG[RebateValue] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I have joined my fact table to my date table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I've tried the following which isn't giving me the result I'm after&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Rebate Current Quarter =
CALCULATE (
    [Rebate Sum],
    FILTER ( 'Date', 'Date'[FY Year &amp;amp; Quarter] = MAX ( 'Date'[FY Year &amp;amp; Quarter] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;I think its filtering to the last quarter in the Date table. I would like it to filter on the last quarter for which there is data in the fact table (vwEdoxabanRebateByCCG) without adding a quarter column to the fact table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any help.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 12:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1962176#M42929</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T12:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Latest Quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1963041#M42988</link>
      <description>&lt;LI-CODE lang="csharp"&gt;[Rebate Current Quarter] =
CALCULATE(
	[Rebate Sum],
	CALCULATETABLE(
		TOPN(1,
			SUMMARIZE(
				YourFactTable,
				'Date'[FY Year &amp;amp; Quarter]
			),
			'Date'[FY Year &amp;amp; Quarter],
			DESC
		),
		ALL( YourFactTable )
	),
	ALL( 'Date' )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Jul 2021 21:32:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1963041#M42988</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-16T21:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Latest Quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965776#M43070</link>
      <description>&lt;P&gt;Thanks very much worked a treat! I'm going to have to try and understand how you did that&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt; Would it be easy to amend to get a measure for the previous quarter?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 12:05:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965776#M43070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-19T12:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Latest Quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965802#M43075</link>
      <description>&lt;LI-CODE lang="csharp"&gt;[Rebate (Prev to Curr Quarter)] =
var CurrentQuarter =
	CALCULATETABLE(
		TOPN(1,
			SUMMARIZE(
				YourFactTable,
				'Date'[FY Year &amp;amp; Quarter]
			),
			'Date'[FY Year &amp;amp; Quarter],
			DESC
		),
		REMOVEFILTERS( YourFactTable )
	)
var Result =
	CALCULATE(
		[Rebate Sum],
		CALCULATETABLE(
			TOPN(1,
				SUMMARIZE(
					YourFactTable,
					'Date'[FY Year &amp;amp; Quarter]
				),
				'Date'[FY Year &amp;amp; Quarter],
				DESC
			),
			ALL( YourFactTable ),
			'Date'[FY Year &amp;amp; Quarter] &amp;lt;&amp;gt; CurrentQuarter
		)
	)
return
	Result&lt;/LI-CODE&gt;&lt;P&gt;The logic will return the [Rebate Sum] for the quarter that has any data in it and is prior to the current one. Therefore if you current quarter is 2021-Q3 and there's no data for 2021-Q2, it'll return the value for 2021-Q1 if there is any data in it. I think you get the gist...&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 12:18:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965802#M43075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-19T12:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Latest Quarter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965860#M43081</link>
      <description>&lt;P&gt;Thanks again! Worked perfectly. I'm fairly new to DAX so it will take me a while to fully understand it.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 12:39:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filter-Latest-Quarter/m-p/1965860#M43081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-19T12:39:39Z</dc:date>
    </item>
  </channel>
</rss>

