<?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: Filtering Table rows by earliest date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3228057#M118300</link>
    <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;P&gt;1) create a calculated table like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Customer = 
ADDCOLUMNS(
    VALUES(Service[CustID]),
    "ServiceID",
    CALCULATE( MIN(Service[ServiceID])),
    "Date",
    CALCULATE( MIN(Service[Date]))
)&lt;/LI-CODE&gt;&lt;P&gt;2) join service and customer table on the ServiceID column&lt;/P&gt;&lt;P&gt;3) add a calculated column in Service table like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Type = IF(RELATED(Service[Type])&amp;lt;&amp;gt;"Mobile", "Others", "Mobile")&lt;/LI-CODE&gt;&lt;P&gt;it worked like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2023 02:51:15 GMT</pubDate>
    <dc:creator>FreemanZ</dc:creator>
    <dc:date>2023-05-10T02:51:15Z</dc:date>
    <item>
      <title>Filtering Table rows by earliest date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3228004#M118292</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;A relative new DAX user here - so a simple topic I am sure.&lt;/P&gt;&lt;P&gt;I have created a table (Services Table) which shows the start date of every service that our customers have. I have created a 2nd related table (Cust Table) using Summarise to show whether the first service each customer has is a Mobile or not.&amp;nbsp;&amp;nbsp;Here are the two fomulaes I have used so far in the Cust Table:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1: Cust Table = &lt;/SPAN&gt;&lt;SPAN&gt;SUMMARIZE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Services Table'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Services Table'&lt;/SPAN&gt;&lt;SPAN&gt;[CustID]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This is working to create the customer ID collum.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;2: Service ID&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;LOOKUPVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;SPAN&gt;Services Table&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;[serviceid]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;SPAN&gt;Services Table&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;[CustID]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;SPAN&gt;Cust Table&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;[CustID]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;This almost works, but of course every time there are multiple start dates for a customer it is populating with my test value of "1".&lt;/P&gt;&lt;P&gt;I have been trying to use a range of formula approaches such as first date, filters, calculate to select the right service based on date, but I'm not sharing them because none of them are working, and I may be on totally the wrong path. Please see below the tables I am trying to see (using dummy data).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clues for me please team of legends?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rangi28.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 02:05:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3228004#M118292</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-10T02:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Table rows by earliest date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3228057#M118300</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;P&gt;1) create a calculated table like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Customer = 
ADDCOLUMNS(
    VALUES(Service[CustID]),
    "ServiceID",
    CALCULATE( MIN(Service[ServiceID])),
    "Date",
    CALCULATE( MIN(Service[Date]))
)&lt;/LI-CODE&gt;&lt;P&gt;2) join service and customer table on the ServiceID column&lt;/P&gt;&lt;P&gt;3) add a calculated column in Service table like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Type = IF(RELATED(Service[Type])&amp;lt;&amp;gt;"Mobile", "Others", "Mobile")&lt;/LI-CODE&gt;&lt;P&gt;it worked like:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 02:51:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3228057#M118300</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-05-10T02:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Table rows by earliest date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3229520#M118459</link>
      <description>&lt;P&gt;Almost legendary thankyou&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;, I've run it on a real data set and the customer table mostly pulls exactly what I want, the exception is where a mobile and an "other" service have the same start date, and it is the earliest date (for a given customer). DAX has to pick one sevice ID over the other, and I'm not sure of its logic. Can we force it to pick Mobile within the Cust table code when there is a choice to be made?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My other challenge is creating the relationship between the cust table and the services table, Im getting a Circular Dependnecy alert - which is very surprising and probably something seperate for me to trouble shoot.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 00:34:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3229520#M118459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-11T00:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering Table rows by earliest date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3229528#M118461</link>
      <description>&lt;P&gt;(Circular Dependancy is sorted out - ignore that please)&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 00:43:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-Table-rows-by-earliest-date/m-p/3229528#M118461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-11T00:43:46Z</dc:date>
    </item>
  </channel>
</rss>

