<?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 How to get previous trimester in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-previous-trimester/m-p/3051292#M105104</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to make a comparison to the previous trimester (months 1-4; 5-8; 9-12) for the trimester that is selected in the graph by the end user.&lt;/P&gt;&lt;P&gt;After trying several things, I am not getting the value (DISTINCTCOUNT) I am looking for.&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CountToT =&lt;BR /&gt;VAR _Trimester = MAX(DIM_Date[Trimester])&lt;BR /&gt;VAR _Calculation1 =&lt;BR /&gt;&amp;nbsp;CALCULATE(&lt;BR /&gt;&amp;nbsp; DISTINCTCOUNT('Fact'[FactKey]),&lt;BR /&gt;&amp;nbsp; FILTER(&lt;BR /&gt;&amp;nbsp; &amp;nbsp;ALLSELECTED(DIM_Date),&lt;BR /&gt;&amp;nbsp; &amp;nbsp;DIM_Date[Trimester] = _Trimester -1&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;_Calculation1&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired result = 757&lt;/P&gt;&lt;P&gt;I do get the correct result for the same trimester last year by using this formula:&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Fact'[FactKey]),&lt;BR /&gt;DATEADD(DIM_Date[Date],-1,YEAR)&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 23:01:32 GMT</pubDate>
    <dc:creator>BI_diva</dc:creator>
    <dc:date>2023-01-30T23:01:32Z</dc:date>
    <item>
      <title>How to get previous trimester</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-previous-trimester/m-p/3051292#M105104</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to make a comparison to the previous trimester (months 1-4; 5-8; 9-12) for the trimester that is selected in the graph by the end user.&lt;/P&gt;&lt;P&gt;After trying several things, I am not getting the value (DISTINCTCOUNT) I am looking for.&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CountToT =&lt;BR /&gt;VAR _Trimester = MAX(DIM_Date[Trimester])&lt;BR /&gt;VAR _Calculation1 =&lt;BR /&gt;&amp;nbsp;CALCULATE(&lt;BR /&gt;&amp;nbsp; DISTINCTCOUNT('Fact'[FactKey]),&lt;BR /&gt;&amp;nbsp; FILTER(&lt;BR /&gt;&amp;nbsp; &amp;nbsp;ALLSELECTED(DIM_Date),&lt;BR /&gt;&amp;nbsp; &amp;nbsp;DIM_Date[Trimester] = _Trimester -1&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;_Calculation1&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired result = 757&lt;/P&gt;&lt;P&gt;I do get the correct result for the same trimester last year by using this formula:&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Fact'[FactKey]),&lt;BR /&gt;DATEADD(DIM_Date[Date],-1,YEAR)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 23:01:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-previous-trimester/m-p/3051292#M105104</guid>
      <dc:creator>BI_diva</dc:creator>
      <dc:date>2023-01-30T23:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous trimester</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-previous-trimester/m-p/3051481#M105115</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="314004" data-lia-user-login="BI_diva" class="lia-mention lia-mention-user"&gt;BI_diva&lt;/a&gt; , Create a new column in Dim_date , Mark it as date table too&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Year Trimester = year([Date]) * 100 + [Trimester]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then have rank column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Trimester Rank = RANKX('dim_Date','Date'[Year Trimester],,ASC,Dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These measures can help. Change the sum expression as per need &lt;BR /&gt;Trimester Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('dim_Date'),'dim_Date'[Trimester Rank]=max('dim_Date'[Trimester Rank])))&lt;BR /&gt;Trimester Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('dim_Date'),'dim_Date'[Trimester Rank]=max('dim_Date'[Trimester Rank])-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This Week= CALCULATE(sum('Table'[Qty]), FILTER(ALL('dim_Date'),'dim_Date'[Year]=max('dim_Date'[Year]) &amp;amp;&amp;amp; 'dim_Date'[Trimester] = Max('dim_Date'[Trimester]) ))&lt;BR /&gt;Last Year Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('dim_Date'),'dim_Date'[Year]=max('dim_Date'[Year])-1 &amp;amp;&amp;amp; 'dim_Date'[Trimester] = Max('dim_Date'[Trimester])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI Custom Period Till Date (PTD)- &lt;A href="https://youtu.be/rQ3Z_LtxwQM" target="_blank"&gt;https://youtu.be/rQ3Z_LtxwQM&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time Intelligence, Part of learn Power BI &lt;A href="https://youtu.be/cN8AO3_vmlY?t=27510" target="_blank"&gt;https://youtu.be/cN8AO3_vmlY?t=27510&lt;/A&gt;&lt;BR /&gt;Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period, &lt;BR /&gt;Custom Period till date: &lt;A href="https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s" target="_blank"&gt;https://youtu.be/aU2aKbnHuWs&amp;amp;t=145s&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 01:58:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-previous-trimester/m-p/3051481#M105115</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-01-31T01:58:11Z</dc:date>
    </item>
  </channel>
</rss>

