<?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 DAX measure in table running out of memory in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-in-table-running-out-of-memory/m-p/2953062#M97984</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have some DAX measures that are used in a table, they are running out of memory. Is there a better way to do this? I want to display this data in a table. What I want to do is measure the number of days between the latest date in the slicer to the invoice date. I have this measure to do this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DaysSinceInvoice = 
VAR MaxDate =  
CALCULATE(
    MAX('Data DateDimension'[TheDate]),
    ALLSELECTED('Data DateDimension'[Date]))
VAR Result = DATEDIFF(Min([InvoiceDate]), MaxDate, DAY)
RETURN CONVERT(Result, INTEGER)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I have three measures that uses the above measure.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;0To30Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 30, Min('Data InvoiceFact'[Owing], 0)
Return Result

30To60Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 30 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 60, Min('Data InvoiceFact'[Owing], 0)
Return Result

60To90Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 60 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 90, Min('Data InvoiceFact'[Owing], 0)
Return Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is displayed in a table. Is there a more efficient way to do this? I am using a measure because I want to base the calculation on the date slicer selection.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 05:42:55 GMT</pubDate>
    <dc:creator>Everton</dc:creator>
    <dc:date>2022-12-07T05:42:55Z</dc:date>
    <item>
      <title>DAX measure in table running out of memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-in-table-running-out-of-memory/m-p/2953062#M97984</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have some DAX measures that are used in a table, they are running out of memory. Is there a better way to do this? I want to display this data in a table. What I want to do is measure the number of days between the latest date in the slicer to the invoice date. I have this measure to do this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DaysSinceInvoice = 
VAR MaxDate =  
CALCULATE(
    MAX('Data DateDimension'[TheDate]),
    ALLSELECTED('Data DateDimension'[Date]))
VAR Result = DATEDIFF(Min([InvoiceDate]), MaxDate, DAY)
RETURN CONVERT(Result, INTEGER)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I have three measures that uses the above measure.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;0To30Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 30, Min('Data InvoiceFact'[Owing], 0)
Return Result

30To60Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 30 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 60, Min('Data InvoiceFact'[Owing], 0)
Return Result

60To90Days = 
VAR Result = IF(Min('Data InvoiceFact'[Owing]) &amp;gt; 0 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;gt;= 60 &amp;amp;&amp;amp; [DaysSinceInvoice] &amp;lt;= 90, Min('Data InvoiceFact'[Owing], 0)
Return Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is displayed in a table. Is there a more efficient way to do this? I am using a measure because I want to base the calculation on the date slicer selection.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 05:42:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-in-table-running-out-of-memory/m-p/2953062#M97984</guid>
      <dc:creator>Everton</dc:creator>
      <dc:date>2022-12-07T05:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure in table running out of memory</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-in-table-running-out-of-memory/m-p/2953707#M98038</link>
      <description>&lt;P&gt;You can try storing the data in variables so that the calculations only have to be done once, e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;0To30Days =
VAR DaysSinceInvoice = [DaysSinceInvoice]
VAR DaysOwing =
    MIN ( 'Data InvoiceFact'[Owing] )
VAR Result =
    IF (
        DaysOwing &amp;gt; 0
            &amp;amp;&amp;amp; DaysSinceInvoice &amp;gt;= 0
            &amp;amp;&amp;amp; DaysSinceInvoice &amp;lt;= 30,
        DaysOwing,
        0
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 10:19:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-in-table-running-out-of-memory/m-p/2953707#M98038</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-12-07T10:19:54Z</dc:date>
    </item>
  </channel>
</rss>

