<?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 using earliest/max date over two tables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3028703#M103395</link>
    <description>&lt;P&gt;This worked perfectly, and it helped me refine my logic; in some cases courses start even though the minimum hasn't been reached (management decides there are other important reasons etc.) and I got weird values there; I added an if as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gem Cursus compleet dagen vooraf = 
AVERAGEX(
    'Courses',
    VAR FirstSubscriptions =
        TOPN(
            'Courses'[MinSubs],
            RELATEDTABLE('Subscribers'),
            Subscribers[Subscriptiondate], ASC
        )
    VAR LastSubscription =
        MAXX(FirstSubscriptions, Subscribers[Subscriptiondate])
    RETURN
    IF ('Courses'[MinSubs]&amp;gt;COUNTROWS(FirstSubscriptions),
        Courses[Startingdate]-TODAY(),
        Courses[Startingdate] - LastSubscription)
)&lt;/LI-CODE&gt;&lt;P&gt;I need to discuss with the team if this is what they want to see, thanks for your help getting me this far!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 13:08:57 GMT</pubDate>
    <dc:creator>SanderVeeken</dc:creator>
    <dc:date>2023-01-18T13:08:57Z</dc:date>
    <item>
      <title>DAX using earliest/max date over two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026344#M103209</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a datamodel of courses with subscribers, each in their own table. They're linked by the unique course ID. The subscriptions have dates, and the courses have starting dates. The courses also have a minimum number of subscribers (otherwise they're cancelled) and there is a feeling in the organization that many courses reach their minimum at the very last minimum. I want to quantify this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to calculate is basically:&lt;/P&gt;&lt;P&gt;AVERAGE(COURSESTARTINGDATE - MAX(EARLIEST X SUBSCRIPTION DATES)&lt;/P&gt;&lt;P&gt;where X is taken from the course table, and subscribers dates are filtered to the course I'm using the starting date of.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just having trouble converting this to DAX, I think it's at least partly because the dates are taken from two different tables. Hopefully someone can point me in the right direction.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 15:50:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026344#M103209</guid>
      <dc:creator>SanderVeeken</dc:creator>
      <dc:date>2023-01-17T15:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: DAX using earliest/max date over two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026398#M103216</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="500127" data-lia-user-login="SanderVeeken" class="lia-mention lia-mention-user"&gt;SanderVeeken&lt;/a&gt;&amp;nbsp;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:02:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026398#M103216</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-01-17T16:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: DAX using earliest/max date over two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026420#M103220</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average days before course starts =
AVERAGEX (
    'Courses',
    VAR FirstSubscriptions =
        TOPN (
            'Courses'[Min subscribers],
            RELATEDTABLE ( 'Subscriptions' ),
            'Subscriptions'[Subscription date], ASC
        )
    VAR LatestSubscription =
        MAXX ( FirstSubscriptions, 'Subscription date' )
    RETURN
        'Courses'[Start date] - LatestSubscription
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:09:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3026420#M103220</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-01-17T16:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: DAX using earliest/max date over two tables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3028703#M103395</link>
      <description>&lt;P&gt;This worked perfectly, and it helped me refine my logic; in some cases courses start even though the minimum hasn't been reached (management decides there are other important reasons etc.) and I got weird values there; I added an if as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Gem Cursus compleet dagen vooraf = 
AVERAGEX(
    'Courses',
    VAR FirstSubscriptions =
        TOPN(
            'Courses'[MinSubs],
            RELATEDTABLE('Subscribers'),
            Subscribers[Subscriptiondate], ASC
        )
    VAR LastSubscription =
        MAXX(FirstSubscriptions, Subscribers[Subscriptiondate])
    RETURN
    IF ('Courses'[MinSubs]&amp;gt;COUNTROWS(FirstSubscriptions),
        Courses[Startingdate]-TODAY(),
        Courses[Startingdate] - LastSubscription)
)&lt;/LI-CODE&gt;&lt;P&gt;I need to discuss with the team if this is what they want to see, thanks for your help getting me this far!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 13:08:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-using-earliest-max-date-over-two-tables/m-p/3028703#M103395</guid>
      <dc:creator>SanderVeeken</dc:creator>
      <dc:date>2023-01-18T13:08:57Z</dc:date>
    </item>
  </channel>
</rss>

