<?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: Finding the different in a value when a condition from another column is met in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2501492#M69158</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Apparantly this need to be optimized. However, and before going into further complicatios would you please try this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Time in between readings =
VAR CurrentTime = Data[unix time]
VAR LocationTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Location] ) )
VAR T1 =
    FILTER ( CurrentTime, Data[unix time] &amp;lt; CurrentTime )
VAR T2 =
    FILTER ( T1, Data[temperature] &amp;lt;&amp;gt; BLANK () )
VAR PreviousTime =
    MAXX ( T2, Data[unix time] )
RETURN
    IF ( NOT ( ISBLANK ( Data[temperature] ) ), CurrentTime - PreviousTime )&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 09 May 2022 08:55:42 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-05-09T08:55:42Z</dc:date>
    <item>
      <title>Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500592#M69132</link>
      <description>&lt;P&gt;Hello! I am having trouble finding the difference in unix time between readings at the same location. Below is an example of a table. The "Time in between readings" is the column I am attempting to create. I highlighted the table in terms of location to emphasize that the difference only needs to be taken if at the same location.&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the command I have, but it does not work properly. Any suggestions on how to do this?&lt;/P&gt;&lt;P&gt;Time in between readings = IF(ISBLANK(Data[temperature]) = FALSE() &amp;amp;&amp;amp; Data[Location = Data[Location], VAR Diff = Data[unix time] - CALCULATE(SUM(Data[unix time]), Filter(Data, Data[Index] = EARLIER(Data[Index]) ) )&amp;nbsp;&lt;/P&gt;&lt;P&gt;return&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF(Diff = VALUE(Data[unix time]), 0, diff))&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 02:16:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500592#M69132</guid>
      <dc:creator>xsaldana</dc:creator>
      <dc:date>2022-05-09T02:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500650#M69135</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt; , New column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new column = &lt;BR /&gt;var _max = max(filter(Table, Data[Location] = earlier(Data[Location]) &amp;amp;&amp;amp; Data[unix time] &amp;lt; earlier( Data[Location] )),[unix time])&lt;BR /&gt;return &lt;BR /&gt;IF(not(ISBLANK(Data[temperature])) , Data[temperature] - max(filter(Table, Data[Location] = earlier(Data[Location]) &amp;amp;&amp;amp; Data[unix time] =_max ), Data[temperature]) , blank())&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 02:55:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500650#M69135</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-05-09T02:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500679#M69136</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello, thank you for taking the time to look at this! Unfortunately, I get an error when I use your command. It says "the expression refers to multiple columns. multiple columns cannot be converted to scalar value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 05:07:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500679#M69136</guid>
      <dc:creator>xsaldana</dc:creator>
      <dc:date>2022-05-09T05:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500685#M69137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you may try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Time in between readings =
VAR CurrentTime = Data[unix time]
VAR LocationTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Location] ) )
VAR PreviousTime =
    MAXX (
        FILTER (
            CurrentTime,
            Data[unix time] &amp;lt; CurrentTime
                &amp;amp;&amp;amp; Data[temperature] &amp;lt;&amp;gt; BLANK ()
        ),
        Data[unix time]
    )
RETURN
    IF ( NOT ( ISBLANK ( Data[temperature] ) ), CurrentTime - PreviousTime )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 03:18:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500685#M69137</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-09T03:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500771#M69141</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for suggesting this! Unfortunately, it did not work. It's stuck on "working on it"&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 05:07:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2500771#M69141</guid>
      <dc:creator>xsaldana</dc:creator>
      <dc:date>2022-05-09T05:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2501492#M69158</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Apparantly this need to be optimized. However, and before going into further complicatios would you please try this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Time in between readings =
VAR CurrentTime = Data[unix time]
VAR LocationTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Location] ) )
VAR T1 =
    FILTER ( CurrentTime, Data[unix time] &amp;lt; CurrentTime )
VAR T2 =
    FILTER ( T1, Data[temperature] &amp;lt;&amp;gt; BLANK () )
VAR PreviousTime =
    MAXX ( T2, Data[unix time] )
RETURN
    IF ( NOT ( ISBLANK ( Data[temperature] ) ), CurrentTime - PreviousTime )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 08:55:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2501492#M69158</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-09T08:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2501975#M69182</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you! It seem this one runs but it doesn't work. The error I get is "The FILTER function expects a table expression for argument", but a string or numeric expression was used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;PowerBI highlights red "CurrentTime" in&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;VAR T1 =
    FILTER ( CurrentTime, &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 12:23:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2501975#M69182</guid>
      <dc:creator>xsaldana</dc:creator>
      <dc:date>2022-05-09T12:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2502070#M69188</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My mistake, I copied the wrong variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Time in between readings =
VAR CurrentTime = Data[unix time]
VAR LocationTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Location] ) )
VAR T1 =
    FILTER ( LocationTable, Data[unix time] &amp;lt; CurrentTime )
VAR T2 =
    FILTER ( T1, Data[temperature] &amp;lt;&amp;gt; BLANK () )
VAR PreviousTime =
    MAXX ( T2, Data[unix time] )
RETURN
    IF ( NOT ( ISBLANK ( Data[temperature] ) ), CurrentTime - PreviousTime )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 14:14:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2502070#M69188</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-09T14:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2502097#M69190</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="376027" data-lia-user-login="xsaldana" class="lia-mention lia-mention-user"&gt;xsaldana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Another solution with some help from power query (if applicaple)&amp;nbsp;&lt;A href="https://www.dropbox.com/t/Gj8t4ZxelU0zRmqA" target="_blank"&gt;https://www.dropbox.com/t/Gj8t4ZxelU0zRmqA&lt;/A&gt;&lt;BR /&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Time in between readings = 
VAR CurrentIndex = Data[Index]
VAR CurrentTime = Data[unix time]
VAR PreviousTime = 
    CALCULATE ( 
        VALUES ( Data[unix time] ),
        ALLEXCEPT ( Data, Data[Location] ),
        Data[Index] = CurrentIndex - 1
    )
RETURN
    IF (
        NOT ISBLANK ( Data[temperature] ) &amp;amp;&amp;amp; NOT ISBLANK ( PreviousTime ),
        CurrentTime - PreviousTime
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 13:02:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2502097#M69190</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-09T13:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the different in a value when a condition from another column is met</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2503211#M69250</link>
      <description>&lt;P&gt;That worked. Thank you!!&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 23:30:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Finding-the-different-in-a-value-when-a-condition-from-another/m-p/2503211#M69250</guid>
      <dc:creator>xsaldana</dc:creator>
      <dc:date>2022-05-09T23:30:43Z</dc:date>
    </item>
  </channel>
</rss>

