<?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 Finding the expiration date (or date of expiry) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-expiration-date-or-date-of-expiry/m-p/3088493#M108088</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an issue where I am trying to write a measure to generate an expiration date based on the current average usage of credits within the current month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Credits used&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/1/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/2/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/3/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/4/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/5/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's set the monthly credit limit to 30. Total credits used so far is 17 and the average per day so far is 3.4. If we were to then add the total credits used so far to the average per day until you hit the 30 credits limit then the expiry date would be 2/8/23.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just am having issues writing this in a measure as I am confused how to return a date after a calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2023 16:56:24 GMT</pubDate>
    <dc:creator>sgeorge930</dc:creator>
    <dc:date>2023-02-20T16:56:24Z</dc:date>
    <item>
      <title>Finding the expiration date (or date of expiry)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-expiration-date-or-date-of-expiry/m-p/3088493#M108088</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an issue where I am trying to write a measure to generate an expiration date based on the current average usage of credits within the current month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Credits used&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/1/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/2/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/3/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/4/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2/5/23&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's set the monthly credit limit to 30. Total credits used so far is 17 and the average per day so far is 3.4. If we were to then add the total credits used so far to the average per day until you hit the 30 credits limit then the expiry date would be 2/8/23.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just am having issues writing this in a measure as I am confused how to return a date after a calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 16:56:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-expiration-date-or-date-of-expiry/m-p/3088493#M108088</guid>
      <dc:creator>sgeorge930</dc:creator>
      <dc:date>2023-02-20T16:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the expiration date (or date of expiry)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-expiration-date-or-date-of-expiry/m-p/3088682#M108099</link>
      <description>&lt;P&gt;I used a datetable, but try this as I broke down each step...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Exp. Date = 
VAR GetTheAverageCreditUsed = AVERAGEX(SUMMARIZE('DateTable',DateTable[Date],"Day Total",SUM(Credits[Credits])),[Day Total])
VAR GetTheTotalCreditUsed = SUMX(SUMMARIZE('DateTable',DateTable[Date],"Day Total",SUM(Credits[Credits])),[Day Total])
VAR AddTheMeasures = GetTheAverageCreditUsed+GetTheTotalCreditUsed
VAR findTheDifference = 30 - AddTheMeasures
VAR findtheMaxDate = MAX('DateTable'[Date])
VAR settheExpDate = findtheMaxDate+findTheDifference

RETURN settheExpDate&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 19:07:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-expiration-date-or-date-of-expiry/m-p/3088682#M108099</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-20T19:07:47Z</dc:date>
    </item>
  </channel>
</rss>

