<?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: DAX statement based on multiple conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-statement-based-on-multiple-conditions/m-p/1480309#M28227</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="268240" data-lia-user-login="alexpork" class="lia-mention lia-mention-user"&gt;alexpork&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please &lt;STRONG&gt;always&lt;/STRONG&gt; show your sample data in &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;text-tabular format&lt;/FONT&gt;&lt;/STRONG&gt; in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a new &lt;STRONG&gt;calculated column&lt;/STRONG&gt; in your table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New column =
IF (
    Table1[Signifier] = "RECO",
    VAR previousRowInDay_ =
        CALCULATETABLE (
            ROW (
                "Signifier_", MAX ( Table1[Signifier] ),
                "DateTime_", MAX ( Table1[DateTime] )
            ),
            ALLEXCEPT ( Table1, Table1[ID] ),
            INT ( Table1[DateTime] ) = INT ( EARLIER ( Table1[DateTime] ) ),
            Table1[DateTime] &amp;lt; EARLIER ( Table1[DateTime] )
        )
    VAR isDSCN_ = MAXX ( previousRowInDay_, [Signifier_] ) = "DSCN"
    VAR previousTimeInDay_ = MAXX ( previousRowInDay_, [DateTime_] )
    VAR diffInMins_ = IF ( isDSCN_, ( Table1[DateTime] - previousTimeInDay_ ) * 24 * 60 )
                 // Time difference converted to minutes. Update if another unit required
    RETURN
        diffInMins_
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Nov 2020 09:01:45 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2020-11-07T09:01:45Z</dc:date>
    <item>
      <title>DAX statement based on multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-statement-based-on-multiple-conditions/m-p/1480168#M28222</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to use DAX to add a TIMEDIFF column based on multiple conditions below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;IF the ID is the same, and the Signifier column has a DSCN value followed by a RECO value on the same day, add a column that subtracts the time difference between those two rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, since the second row and third row fulfills these conditions, it would subtract 17:17 and 8:31 and add the difference in a new column.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 01:43:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-statement-based-on-multiple-conditions/m-p/1480168#M28222</guid>
      <dc:creator>alexpork</dc:creator>
      <dc:date>2020-11-07T01:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: DAX statement based on multiple conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-statement-based-on-multiple-conditions/m-p/1480309#M28227</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="268240" data-lia-user-login="alexpork" class="lia-mention lia-mention-user"&gt;alexpork&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please &lt;STRONG&gt;always&lt;/STRONG&gt; show your sample data in &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;text-tabular format&lt;/FONT&gt;&lt;/STRONG&gt; in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a new &lt;STRONG&gt;calculated column&lt;/STRONG&gt; in your table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New column =
IF (
    Table1[Signifier] = "RECO",
    VAR previousRowInDay_ =
        CALCULATETABLE (
            ROW (
                "Signifier_", MAX ( Table1[Signifier] ),
                "DateTime_", MAX ( Table1[DateTime] )
            ),
            ALLEXCEPT ( Table1, Table1[ID] ),
            INT ( Table1[DateTime] ) = INT ( EARLIER ( Table1[DateTime] ) ),
            Table1[DateTime] &amp;lt; EARLIER ( Table1[DateTime] )
        )
    VAR isDSCN_ = MAXX ( previousRowInDay_, [Signifier_] ) = "DSCN"
    VAR previousTimeInDay_ = MAXX ( previousRowInDay_, [DateTime_] )
    VAR diffInMins_ = IF ( isDSCN_, ( Table1[DateTime] - previousTimeInDay_ ) * 24 * 60 )
                 // Time difference converted to minutes. Update if another unit required
    RETURN
        diffInMins_
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 09:01:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-statement-based-on-multiple-conditions/m-p/1480309#M28227</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-11-07T09:01:45Z</dc:date>
    </item>
  </channel>
</rss>

