<?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: Need help to get a min date value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3588338#M138508</link>
    <description>&lt;P style="text-align: justify; text-justify: inter-ideograph; background: white;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="655285" data-lia-user-login="Samhunt" class="lia-mention lia-mention-user"&gt;Samhunt&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background: white;"&gt;&lt;SPAN&gt;I have understood about your problem, here is the solution I offer:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Here are the data of the two tables&lt;SPAN&gt;：&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;'Sales Data'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;'accommodations'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Make sure that there is a relationship between the two tables based on the 'accommodation' column.&lt;SPAN&gt;&amp;nbsp;If there is no relationship between the two tables in the "Model View", you can create them manually, dragging the 'accommodation' field from one table to the 'accommodation' field in the other table.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the following DAX formula to calculate the minimum date:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;First rented date = MIN('Sales Data'[date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is no relationship between the two tables, you can also use a different DAX:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;First rented date2 = CALCULATE(
    MIN('Sales Data'[date]),
    FILTER(
       'Sales Data',
        'Sales Data'[accommodation] = MAX('Accommodations'[accommodation])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Here is the result&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;Nono Chen&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;If this&lt;STRONG&gt;&lt;I&gt;&amp;nbsp;post&amp;nbsp;helps, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution &amp;nbsp;to help the other members find it more quickly.&lt;/I&gt;&lt;/STRONG&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;STRONG&gt;&lt;I&gt;&lt;STRONG&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/STRONG&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 07:58:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-12-18T07:58:19Z</dc:date>
    <item>
      <title>Need help to get a min date value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3587594#M138460</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables 'Sales Data' and 'Accommodations'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import the first date that an accommodation was first rented from the sales data table and put it in a new column in accommodations table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column with the matching data is called&amp;nbsp; 'accommodation' in both tables and the table with the dates its called 'date'&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2023 15:13:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3587594#M138460</guid>
      <dc:creator>Samhunt</dc:creator>
      <dc:date>2023-12-17T15:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to get a min date value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3588213#M138500</link>
      <description>&lt;P&gt;Certainly! In Power BI, you can achieve this by creating a relationship between the 'Accommodations' table and the 'Sales Data' table based on the 'accommodation' column. Once you establish the relationship, you can use DAX (Data Analysis Expressions) to create a new column in the 'Accommodations' table that fetches the minimum date from the 'date' column in the 'Sales Data' table.&lt;/P&gt;&lt;P&gt;Here's a step-by-step guide:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Load Your Data:&lt;/STRONG&gt; Ensure that both 'Accommodations' and 'Sales Data' tables are loaded into Power BI.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a Relationship:&lt;/STRONG&gt; In the 'Relationships' view, create a relationship between the 'accommodation' column in the 'Accommodations' table and the 'accommodation' column in the 'Sales Data' table.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a New Column:&lt;/STRONG&gt; In the 'Accommodations' table, go to the 'Model' view, select the table, and click on 'New column' in the 'Modeling' tab.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Write DAX Formula:&lt;/STRONG&gt; Write a DAX formula to fetch the minimum date from the 'date' column in the 'Sales Data' table for each 'accommodation' in the 'Accommodations' table. Use the RELATEDTABLE and MINX functions. Here's an example:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;DAX Measure:&lt;/P&gt;&lt;P&gt;MinDate = MINX(RELATEDTABLE('Sales Data'), 'Sales Data'[date])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;This formula uses RELATEDTABLE to get a table of related 'Sales Data' rows for each 'Accommodation' and then uses MINX to find the minimum date in that table.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Apply Changes:&lt;/STRONG&gt; After creating the new column, click on 'Apply Changes' to apply the changes to your data model.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Now, your 'Accommodations' table should have a new column ('MinDate') that contains the minimum date from the 'Sales Data' table for each 'accommodation'. You can use this column in your reports and visuals.&lt;/P&gt;&lt;P&gt;Remember to adjust column and table names according to your actual dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 06:56:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3588213#M138500</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-18T06:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to get a min date value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3588338#M138508</link>
      <description>&lt;P style="text-align: justify; text-justify: inter-ideograph; background: white;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="655285" data-lia-user-login="Samhunt" class="lia-mention lia-mention-user"&gt;Samhunt&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background: white;"&gt;&lt;SPAN&gt;I have understood about your problem, here is the solution I offer:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Here are the data of the two tables&lt;SPAN&gt;：&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;'Sales Data'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;'accommodations'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Make sure that there is a relationship between the two tables based on the 'accommodation' column.&lt;SPAN&gt;&amp;nbsp;If there is no relationship between the two tables in the "Model View", you can create them manually, dragging the 'accommodation' field from one table to the 'accommodation' field in the other table.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the following DAX formula to calculate the minimum date:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;First rented date = MIN('Sales Data'[date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is no relationship between the two tables, you can also use a different DAX:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;First rented date2 = CALCULATE(
    MIN('Sales Data'[date]),
    FILTER(
       'Sales Data',
        'Sales Data'[accommodation] = MAX('Accommodations'[accommodation])
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;Here is the result&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;SPAN&gt;If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;Nono Chen&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt; background: white;"&gt;&lt;SPAN&gt;If this&lt;STRONG&gt;&lt;I&gt;&amp;nbsp;post&amp;nbsp;helps, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution &amp;nbsp;to help the other members find it more quickly.&lt;/I&gt;&lt;/STRONG&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="" style="background: white;"&gt;&lt;STRONG&gt;&lt;I&gt;&lt;STRONG&gt;&lt;I&gt;&amp;nbsp;&lt;/I&gt;&lt;/STRONG&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 07:58:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-to-get-a-min-date-value/m-p/3588338#M138508</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-18T07:58:19Z</dc:date>
    </item>
  </channel>
</rss>

