<?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: YTD and MAT values needs to be calculated base on the slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1956716#M42711</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , if you have date&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have Qtr year, Have table with rank on YYYYQ&lt;/P&gt;
&lt;P&gt;QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))&lt;/P&gt;
&lt;P&gt;YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 4 Qtr&lt;/P&gt;
&lt;P&gt;Rolling 4 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Quarter))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New column&lt;/P&gt;
&lt;P&gt;Qtr Rank = RANKX(all('Date'),'Date'[Year Qtr],,ASC,Dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measures&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))&lt;BR /&gt;Last Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 4 Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]&amp;gt;=max('Date'[Qtr Rank])-4 &amp;amp;&amp;amp; 'Date'[Qtr Rank]&amp;lt;=max('Date'[Qtr Rank]) ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) &amp;amp;&amp;amp; 'Date'[Qtr] &amp;lt;= Max('Date'[Qtr]) ))&lt;BR /&gt;LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 &amp;amp;&amp;amp; 'Date'[Qtr] &amp;lt;= Max('Date'[Qtr])))&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jul 2021 08:38:02 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-07-14T08:38:02Z</dc:date>
    <item>
      <title>YTD and MAT values needs to be calculated base on the slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1956319#M42706</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Ex: if I select Q2 2020 from the quarter slicer,&lt;/P&gt;&lt;P&gt;Then &lt;STRONG&gt;YTD = Q1 2020 + Q2 2020&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAT = Q3 2019 + Q4 2019 +Q1 2020 + Q2 2020&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QTR&lt;/STRONG&gt; = Current Quarter selected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I select Q3 2020 from the quarter slicer,&lt;/P&gt;&lt;P&gt;Then &lt;STRONG&gt;YTD = Q1 2020 + Q2 2020 + Q3 2020&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAT = Q4 2019 +Q1 2020 + Q2 2020 + Q3 2020&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QTR&lt;/STRONG&gt; = Current Quarter selected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My slicer fileds are : YTD, MAT, QTR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please some one help me with the DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Pallavi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 06:00:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1956319#M42706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-14T06:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: YTD and MAT values needs to be calculated base on the slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1956716#M42711</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , if you have date&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have Qtr year, Have table with rank on YYYYQ&lt;/P&gt;
&lt;P&gt;QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))&lt;/P&gt;
&lt;P&gt;YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 4 Qtr&lt;/P&gt;
&lt;P&gt;Rolling 4 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Quarter))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New column&lt;/P&gt;
&lt;P&gt;Qtr Rank = RANKX(all('Date'),'Date'[Year Qtr],,ASC,Dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measures&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))&lt;BR /&gt;Last Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 4 Qtr = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]&amp;gt;=max('Date'[Qtr Rank])-4 &amp;amp;&amp;amp; 'Date'[Qtr Rank]&amp;lt;=max('Date'[Qtr Rank]) ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) &amp;amp;&amp;amp; 'Date'[Qtr] &amp;lt;= Max('Date'[Qtr]) ))&lt;BR /&gt;LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 &amp;amp;&amp;amp; 'Date'[Qtr] &amp;lt;= Max('Date'[Qtr])))&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 08:38:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1956716#M42711</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-07-14T08:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: YTD and MAT values needs to be calculated base on the slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1957207#M42725</link>
      <description>&lt;P&gt;Hey Amit,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with above dax formula, Its confusing to build this.&lt;/P&gt;&lt;P&gt;Please help me with demo file if possible, it would be really helpfull&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 11:23:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/YTD-and-MAT-values-needs-to-be-calculated-base-on-the-slicer/m-p/1957207#M42725</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-14T11:23:51Z</dc:date>
    </item>
  </channel>
</rss>

