<?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: Calculating time difference between rows with slicers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099804#M16128</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Seems like the issue is that when you are getting the MAX, it is pulling for Line 11 or basically the wrong thing and this is likely because of your ALLSELECTED which I try not to use if at all possible and not sure why you need it. I would start by dropping it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This post may help.&amp;nbsp;See my article on Mean Time Between Failure (MTBF) which uses EARLIER: &lt;A href="http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586" target="_blank"&gt;http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a great version of that in my book, DAX Cookbook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if you can paste some of your source data or sample source data I can probably adapt the formula from my book for you.&amp;nbsp;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>Thu, 21 May 2020 02:37:18 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-05-21T02:37:18Z</dc:date>
    <item>
      <title>Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099446#M16111</link>
      <description>&lt;P&gt;I have a DAX formula that is calculating the time difference between each consecutive row in a table visulaization. It works when I have only one process selected, but when I select multiple processes the Time Diff measure is incorrect. See images below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAX formula:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Time Diff = VAR Previous = CALCULATE ( MAX ('Main Table'[Date.Time] ), FILTER ( ALLSELECTED ( 'Main Table' ), 'Main Table'[Date.Time] &amp;lt; MAX ( 'Main Table'[Date.Time] ) ) ) RETURN DATEDIFF ( Previous, MAX ( 'Main Table'[Date.Time] ), MINUTE ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 19:42:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099446#M16111</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-20T19:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099751#M16124</link>
      <description>&lt;P&gt;It looks like it is correctly calculating the difference between rows (regardless of the Process).&amp;nbsp; If you'd like to keep the Process in context, you need to add VALUES('Main Table'[Process]) to your Calculate().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 02:19:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099751#M16124</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-05-21T02:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099804#M16128</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Seems like the issue is that when you are getting the MAX, it is pulling for Line 11 or basically the wrong thing and this is likely because of your ALLSELECTED which I try not to use if at all possible and not sure why you need it. I would start by dropping it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This post may help.&amp;nbsp;See my article on Mean Time Between Failure (MTBF) which uses EARLIER: &lt;A href="http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586" target="_blank"&gt;http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a great version of that in my book, DAX Cookbook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if you can paste some of your source data or sample source data I can probably adapt the formula from my book for you.&amp;nbsp;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>Thu, 21 May 2020 02:37:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099804#M16128</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-05-21T02:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099810#M16129</link>
      <description>&lt;P&gt;I would start by dropping your ALLSELECTED and not using CALCULATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See my article on Mean Time Between Failure (MTBF) which uses EARLIER: &lt;A href="http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586" target="_blank"&gt;http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a great version of that in my book, DAX Cookbook. If you can post sample data, I'll try to adapt it for your situation.&amp;nbsp;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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 02:38:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1099810#M16129</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-05-21T02:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1100022#M16134</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Incase you want difference between each row&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Time Difference = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var _a = MAX('Table'[Date/Time])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var _previousdate = CALCULATE(MAX('Table'[Date/Time]), FILTER(ALLSELECTED('Table'[Date/Time]),'Table'[Date/Time] &amp;lt; _a) )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(DATEDIFF(_previousdate,_a,MINUTE))&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;This measure too gives the same results.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Time Difference = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _a =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAX ( 'Table'[Date/Time] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _previousdate =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAX ( 'Table'[Date/Time] ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLEXCEPT('Table', 'Table'[Process])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Table'[Date/Time] &amp;lt; _a&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATEDIFF (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_previousdate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_a,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MINUTE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Harsh Nathani&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 May 2020 06:18:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1100022#M16134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-21T06:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time difference between rows with slicers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1100536#M16160</link>
      <description>&lt;P&gt;That works! Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 11:51:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-difference-between-rows-with-slicers/m-p/1100536#M16160</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-21T11:51:23Z</dc:date>
    </item>
  </channel>
</rss>

