<?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: Dax help Max date with exclusions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367645#M173405</link>
    <description>&lt;P&gt;Please excuse&amp;nbsp; me if i'm totally off here but i'm thinking the last part is trying to calculate the age whereas there is a column in the data " Req Age" that shows the age each day, so i just need the max ( but only if it is complete, otherwise clock is still ticking and i don't want to include in number - trying to under stand if the other part filter out all the req numbers tyhat are still showing in todays data, which will take me a while to follow&amp;nbsp;&lt;BR /&gt;Many thanks for your help, i'll examine further&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 14:54:49 GMT</pubDate>
    <dc:creator>GJD23</dc:creator>
    <dc:date>2025-01-16T14:54:49Z</dc:date>
    <item>
      <title>Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367494#M173401</link>
      <description>&lt;P&gt;Hi everyone - bit stuck and looking for some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have daily files showing purchase reqs all rolled in to a big data set. So a req will appear each day ( and the req age will increase) each day until it is converted to a PO, at which point it will no longer show.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to work out the final age of each req, or how long it took to convert to a PO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i want to discount all "Pucrchase Req" numbers that appear in the latest days data ( as these are still open) and then retrieve the MAX "REqAge" for all the others and ultimatley calculate %age that are less than or equal to 14 (days) and those greater.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can't quite get my head around it - filter out all Purchase Req numbers that appear in the latest days data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help appreciated&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:11:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367494#M173401</guid>
      <dc:creator>GJD23</dc:creator>
      <dc:date>2025-01-16T14:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367558#M173403</link>
      <description>&lt;P&gt;I think you could create a calculated column like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Age =
VAR LatestDate =
    CALCULATE ( MAX ( 'Table'[Date] ), REMOVEFILTERS () )
VAR AllReqs =
    ALL ( 'Table'[Req ID] )
VAR LatestReqs =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Req ID] ),
        REMOVEFILTERS (),
        'Table'[Date] = LatestDate
    )
VAR ValidReqs =
    EXCEPT ( AllReqs, LatestReqs )
VAR Result =
    IF (
        'Table'[Req ID] IN ValidReqs,
        VAR StartDate =
            CALCULATE ( MIN ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Req ID] ) )
        VAR EndDate =
            CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Req ID] ) )
        VAR Result =
            DATEDIFF ( StartDate, EndDate, DAY )
        RETURN
            Result
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:36:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367558#M173403</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-01-16T14:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367645#M173405</link>
      <description>&lt;P&gt;Please excuse&amp;nbsp; me if i'm totally off here but i'm thinking the last part is trying to calculate the age whereas there is a column in the data " Req Age" that shows the age each day, so i just need the max ( but only if it is complete, otherwise clock is still ticking and i don't want to include in number - trying to under stand if the other part filter out all the req numbers tyhat are still showing in todays data, which will take me a while to follow&amp;nbsp;&lt;BR /&gt;Many thanks for your help, i'll examine further&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 14:54:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367645#M173405</guid>
      <dc:creator>GJD23</dc:creator>
      <dc:date>2025-01-16T14:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367688#M173406</link>
      <description>&lt;P&gt;If you already have the req age column then that makes things simpler.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Final Age =
VAR LatestDate =
    CALCULATE ( MAX ( 'Table'[Date] ), REMOVEFILTERS () )
VAR AllReqs =
    ALL ( 'Table'[Req ID] )
VAR LatestReqs =
    CALCULATETABLE (
        DISTINCT ( 'Table'[Req ID] ),
        REMOVEFILTERS (),
        'Table'[Date] = LatestDate
    )
VAR ValidReqs =
    EXCEPT ( AllReqs, LatestReqs )
VAR Result =
    IF (
        'Table'[Req ID] IN ValidReqs,
        VAR Result =
            CALCULATE ( MAX ( 'Table'[Req Age] ), ALLEXCEPT ( 'Table', 'Table'[Req ID] ) )
        RETURN
            Result
    )
RETURN
    Result
&lt;/LI-CODE&gt;
&lt;P&gt;The code calculates the latest date in all the data, then retrieves all values for the req ID and the values for the req ID which have an entry on the latest date. It excludes the ones with the latest date from the list of all of them and checks to see if the current value for req ID exists in the remainder. If it exists, then it gets the max value for req age for that req ID, otherwise it returns blank.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 15:03:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367688#M173406</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2025-01-16T15:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367759#M173410</link>
      <description>&lt;P&gt;Thanks John, I'll have a play with that&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 15:29:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367759#M173410</guid>
      <dc:creator>GJD23</dc:creator>
      <dc:date>2025-01-16T15:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367807#M173414</link>
      <description>&lt;P&gt;AWESOME - it works thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 16:00:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367807#M173414</guid>
      <dc:creator>GJD23</dc:creator>
      <dc:date>2025-01-16T16:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dax help Max date with exclusions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367823#M173417</link>
      <description>&lt;P&gt;It works John - thank you so much - i thought I had uncovered a blip but as usual it was my bad&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 16:14:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-help-Max-date-with-exclusions/m-p/4367823#M173417</guid>
      <dc:creator>GJD23</dc:creator>
      <dc:date>2025-01-16T16:14:12Z</dc:date>
    </item>
  </channel>
</rss>

