<?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: calculate the days between two date( but two dates in a columns) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2133590#M48969</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="314492" data-lia-user-login="Poo1405" class="lia-mention lia-mention-user"&gt;Poo1405&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check if this is what you want:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DateDiff_Call =
VAR LeadStatusCount =
    CALCULATE (
        DISTINCTCOUNT ( 'file combine'[statusLead] ),
        ALLEXCEPT ( 'file combine', 'file combine'[leadid], 'file combine'[campaign] )
    )
VAR t =
    FILTER (
        ALLEXCEPT ( 'file combine', 'file combine'[leadid], 'file combine'[campaign] ),
        LeadStatusCount = 2
    )
VAR Date_Ready_to_call =
    CALCULATE (
        MAX ( 'file combine'[date1] ),
        FILTER ( t, [statusLead] = "Ready to call" )
    )
VAR Date_Called =
    CALCULATE (
        MAX ( 'file combine'[date1] ),
        FILTER ( t, [statusLead] = "Called" )
    )
RETURN
    DATEDIFF ( Date_Ready_to_call, Date_Called, DAY )
&lt;/LI-CODE&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Oct 2021 02:36:04 GMT</pubDate>
    <dc:creator>Icey</dc:creator>
    <dc:date>2021-10-14T02:36:04Z</dc:date>
    <item>
      <title>calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2127334#M48803</link>
      <description>&lt;P&gt;I need to calculate the days between two dates in a couple of rows (you can see clearly when seeing the screenshot below) base on other attributes like "leadid" and "campaign". my data set has lots of couples like this, the clear difference that can easily find is one row has "statuslead": ready to call and another is called and the date of its row, the rest are the same information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have consulted many other posts in the community about how to calculate the days between two dates but most of them are from 2 different columns.&lt;/P&gt;&lt;P&gt;However, it is not suitable for my case, I want to calculate the average of the days between 2 rows has the same information but different date based on leadid. In addition, as far as I can see, the row has statuslead: ready to call is always comes before the row has statuslead: called. Moreover, I also want the return result to be a large number or zero (&amp;gt;= 0) to eliminate the cases where rows have no 2 status to be able to match and calculate.&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;I need help from everyone,&amp;nbsp;Thanks for taking the time to take a look at my post!!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I also share my .pbix file with everyone to easier to observe!!!&amp;nbsp;&lt;BR /&gt;&lt;A href="https://drive.google.com/file/d/1fDhVfvHzE6gKbL6OMFhomgoAqi7gWsLJ/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1fDhVfvHzE6gKbL6OMFhomgoAqi7gWsLJ/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 12:46:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2127334#M48803</guid>
      <dc:creator>Poo1405</dc:creator>
      <dc:date>2021-10-11T12:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2133590#M48969</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="314492" data-lia-user-login="Poo1405" class="lia-mention lia-mention-user"&gt;Poo1405&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check if this is what you want:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DateDiff_Call =
VAR LeadStatusCount =
    CALCULATE (
        DISTINCTCOUNT ( 'file combine'[statusLead] ),
        ALLEXCEPT ( 'file combine', 'file combine'[leadid], 'file combine'[campaign] )
    )
VAR t =
    FILTER (
        ALLEXCEPT ( 'file combine', 'file combine'[leadid], 'file combine'[campaign] ),
        LeadStatusCount = 2
    )
VAR Date_Ready_to_call =
    CALCULATE (
        MAX ( 'file combine'[date1] ),
        FILTER ( t, [statusLead] = "Ready to call" )
    )
VAR Date_Called =
    CALCULATE (
        MAX ( 'file combine'[date1] ),
        FILTER ( t, [statusLead] = "Called" )
    )
RETURN
    DATEDIFF ( Date_Ready_to_call, Date_Called, DAY )
&lt;/LI-CODE&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 02:36:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2133590#M48969</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2021-10-14T02:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2133738#M48972</link>
      <description>&lt;P&gt;I really appreciate your help; the number shown in the table is very similar to my expectations. Still, I have a problem doing other calculations based on that number (e.g., calculate the average, min, max) to serve statistics on each campaign, source, or calculate KPI for that number under the chart or graph. It didn't work.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;From what I observe, the metrics datediff must appear together with the leadid to be displayed. However, I still want it to be a number that can be displayed independently, making it more suitable and easier to represent on the graph or chart.&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;</description>
      <pubDate>Thu, 14 Oct 2021 03:49:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2133738#M48972</guid>
      <dc:creator>Poo1405</dc:creator>
      <dc:date>2021-10-14T03:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134377#M48983</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="314492" data-lia-user-login="Poo1405" class="lia-mention lia-mention-user"&gt;Poo1405&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For avg, max, etc., try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Avg by campaign =
AVERAGEX ( VALUES ( 'file combine'[leadid] ), [DateDiff_Call] )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Max by campaign =
MAXX ( VALUES ( 'file combine'[leadid] ), [DateDiff_Call] )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;In addition, [Date_Diff] measure is calculated based on date1 of each leadid, if you want to show it&amp;nbsp;&lt;SPAN&gt;independently, what are the implications of the results you expect to display?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 08:16:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134377#M48983</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2021-10-14T08:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134484#M48989</link>
      <description>&lt;P&gt;Thank you so much for being so helpful; I intend to use the duration of two dates like a KPI to observe and&amp;nbsp;evaluate the performance and quality of call center, so need it can be shown dependent on multi-view (real to source, campaign, date, ...) to&amp;nbsp;so that can best improve my performance and planning.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway,&amp;nbsp;once again, I want to thank &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="164362" data-lia-user-login="Icey" class="lia-mention lia-mention-user"&gt;Icey&lt;/a&gt;&amp;nbsp;for supporting me; maybe now the average, min, max index of duration (dateiff) can help me create a dashboard that can enhance overall observation of a sufficient assessment of the quality of the call center.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 09:02:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134484#M48989</guid>
      <dc:creator>Poo1405</dc:creator>
      <dc:date>2021-10-14T09:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the days between two date( but two dates in a columns)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134505#M48991</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="314492" data-lia-user-login="Poo1405" class="lia-mention lia-mention-user"&gt;Poo1405&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are welcome. Glad to be able to help you. Wish you a happy life.&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 09:13:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-the-days-between-two-date-but-two-dates-in-a-columns/m-p/2134505#M48991</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2021-10-14T09:13:13Z</dc:date>
    </item>
  </channel>
</rss>

