<?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: DateDiff of the same Date column based in different condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3493286#M133793</link>
    <description>&lt;P&gt;Almost, in my case, in your example Order ID is 1 for all your lignes and you have the same sample for other Order IDs&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2023 08:19:38 GMT</pubDate>
    <dc:creator>I2SA</dc:creator>
    <dc:date>2023-10-24T08:19:38Z</dc:date>
    <item>
      <title>DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3487651#M133456</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I try to make the difference between dates from the same column regarding statuts of an other column and for each Order_ID&lt;BR /&gt;I got an error message : "A table of multiple values was provided when a single value was expected."&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Datediff2 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; var_StartDate = &lt;/SPAN&gt;&lt;SPAN&gt;calculate&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;lookupvalue&lt;/SPAN&gt;&lt;SPAN&gt;(ORDER_STATUS[LOG_DATE],ORDER_STATUS[STATUS],&lt;/SPAN&gt;&lt;SPAN&gt;"pending_reception"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&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</description>
      <pubDate>Fri, 20 Oct 2023 12:35:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3487651#M133456</guid>
      <dc:creator>I2SA</dc:creator>
      <dc:date>2023-10-20T12:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3489837#M133579</link>
      <description>&lt;P&gt;What made you use LOOKUPVALUE for this?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 17:32:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3489837#M133579</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-22T17:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3490598#M133641</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="634016" data-lia-user-login="I2SA" class="lia-mention lia-mention-user"&gt;I2SA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I wonder that you want to calculate the duration of the log from preparation to completion, I created simple samples and you may check the results below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = var _StartDate = CALCULATE(MIN('Table'[LOG_DATE]),FILTER('Table','Table'[STATUS]="pending_reception"))
var _EndDate = CALCULATE(MAX('Table'[LOG_DATE]),FILTER('Table','Table'[STATUS]="fulfilled"))
return
IF(not ISBLANK(_EndDate),DATEDIFF(_StartDate,_EndDate,DAY),0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please feel free to correct me and provide more information if I have misunderstood you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An attachment for your reference. Hope it helps!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 07:12:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3490598#M133641</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-23T07:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3493286#M133793</link>
      <description>&lt;P&gt;Almost, in my case, in your example Order ID is 1 for all your lignes and you have the same sample for other Order IDs&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 08:19:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3493286#M133793</guid>
      <dc:creator>I2SA</dc:creator>
      <dc:date>2023-10-24T08:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3493845#M133828</link>
      <description>&lt;P&gt;I'am trying &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 12:30:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3493845#M133828</guid>
      <dc:creator>I2SA</dc:creator>
      <dc:date>2023-10-24T12:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3495161#M133895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="634016" data-lia-user-login="I2SA" class="lia-mention lia-mention-user"&gt;I2SA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I made a new attempt and you can check the following results:&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;Measure = 
VAR _AddColumn =
    SUMMARIZE(
        'Table',
        'Table'[ORDER_ID],
        "Mindate",
                MINX (
                    FILTER ( ALL('Table'), [ORDER_ID] = EARLIER ( [ORDER_ID] ) &amp;amp;&amp;amp; [STATUS] = "pending_reception" ),
                    [LOG_DATE]
                ),
                 "Maxdate",
                MAXX (
                    FILTER (ALL('Table'), [ORDER_ID] = EARLIER ( [ORDER_ID]) &amp;amp;&amp;amp; [STATUS] = "fulfilled" ),
                    [LOG_DATE]
                )
 
    )
VAR result =
    ADDCOLUMNS ( _AddColumn, "result", DATEDIFF ( [Mindate], [Maxdate], DAY ) )
return
SUMX(result,[result])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An attachment for your reference. Hope it helps!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 03:05:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3495161#M133895</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-25T03:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3498263#M134054</link>
      <description>&lt;P&gt;Thanks !&lt;BR /&gt;I think it's should work but I have an issue, for some cases I have several Fulfilled Dates for the same ID because I have log from different systems. I think I have to add an index in order to took the oldest one.&lt;BR /&gt;Do you know how to make this in Power Query ?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:14:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3498263#M134054</guid>
      <dc:creator>I2SA</dc:creator>
      <dc:date>2023-10-26T08:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: DateDiff of the same Date column based in different condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3498312#M134057</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="634016" data-lia-user-login="I2SA" class="lia-mention lia-mention-user"&gt;I2SA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try combining group by and index columns as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; background: white;"&gt;&lt;SPAN&gt;Hope it helps!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; background: white; box-sizing: border-box;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; background: white; box-sizing: border-box;"&gt;&lt;SPAN&gt;Best regards,&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; background: white; box-sizing: border-box;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 08:30:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DateDiff-of-the-same-Date-column-based-in-different-condition/m-p/3498312#M134057</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-26T08:30:19Z</dc:date>
    </item>
  </channel>
</rss>

