<?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: Quarter and Week Aging in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388786#M25414</link>
    <description>&lt;P&gt;You can use this column expression on your Date table to get a quarter index that is 0 in the current quarter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Quarter Index = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var todayquarterindex = YEAR(TODAY())*4 + QUARTER(TODAY())&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var thisindex = YEAR('Date'[Date])*4 + QUARTER('Date'[Date])&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return thisindex - todayquarterindex &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;A similar approach can be used for Week Index&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Week Index = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var todaystartofweek = TODAY() - WEEKDAY(TODAY())+1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var thisstartofweek = 'Date'[Date] -WEEKDAY('Date'[Date]) + 1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return DATEDIFF(todaystartofweek, thisstartofweek, DAY)/7&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 23 Sep 2020 01:57:18 GMT</pubDate>
    <dc:creator>mahoneypat</dc:creator>
    <dc:date>2020-09-23T01:57:18Z</dc:date>
    <item>
      <title>Quarter and Week Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388586#M25408</link>
      <description>&lt;P&gt;I have a fiscal calendar lookup table that I'm looking to create a couple of extra calculations in, but I can't seem to figure out how to get them to do what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need are what my company calls "Quarter Aging" and "Week Aging", and basically the formula should assign the value "0" for the current quarter/week, and then count (positive or negative) the quarters/weeks away from the current one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: Current quarter is assigned the value of "0", last quarter would be "-1", next quarter would be "1" all the way up and down the column (with the current quarter/week being somewhere in the middle of the data).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have caluclations for week index and quarter index, as well as calculations that identify the current quarter and current week. Does anyone know how I can do this?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 00:14:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388586#M25408</guid>
      <dc:creator>etuckeriv</dc:creator>
      <dc:date>2020-09-23T00:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Quarter and Week Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388606#M25410</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="151760" data-lia-user-login="etuckeriv" class="lia-mention lia-mention-user"&gt;etuckeriv&lt;/a&gt;&amp;nbsp;- So, seems like an application of Sequential:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231#M116" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231#M116&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide sample data and expected output?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also just posted this custom DAX 445 custom calendar which some of the logic in there may help as well:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/DAX-Custom-445-Calendar/td-p/1388582" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/DAX-Custom-445-Calendar/td-p/1388582&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 00:25:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388606#M25410</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-23T00:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Quarter and Week Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388786#M25414</link>
      <description>&lt;P&gt;You can use this column expression on your Date table to get a quarter index that is 0 in the current quarter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Quarter Index = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var todayquarterindex = YEAR(TODAY())*4 + QUARTER(TODAY())&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var thisindex = YEAR('Date'[Date])*4 + QUARTER('Date'[Date])&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return thisindex - todayquarterindex &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;A similar approach can be used for Week Index&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Week Index = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var todaystartofweek = TODAY() - WEEKDAY(TODAY())+1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var thisstartofweek = 'Date'[Date] -WEEKDAY('Date'[Date]) + 1&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return DATEDIFF(todaystartofweek, thisstartofweek, DAY)/7&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Sep 2020 01:57:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1388786#M25414</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-09-23T01:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Quarter and Week Aging</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1389044#M25419</link>
      <description>&lt;P&gt;This actually turned out to be pretty simple. All I ended up doing was subtracting the Week/Quarter Index Number from the&amp;nbsp;&lt;EM&gt;current&lt;/EM&gt; Quarter/Week Index Number with this formula:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=FiscalCalendarTable[QuarterIndex]-LOOKUPVALUE(FiscalCalendarTable[QuarterIndex],FiscalCalendarTable[Today?],TRUE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the guidance, everyone! I learned about a couple new functions while reverse engineering Greg's solutions below!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 03:52:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Quarter-and-Week-Aging/m-p/1389044#M25419</guid>
      <dc:creator>etuckeriv</dc:creator>
      <dc:date>2020-09-23T03:52:23Z</dc:date>
    </item>
  </channel>
</rss>

