<?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: Check event occurred within set time of previous event of same unique ID in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867308#M151071</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707504" data-lia-user-login="KvO88" class="lia-mention lia-mention-user"&gt;KvO88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize for ignoring the extra condition, please try the following expression:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = var _t =ADDCOLUMNS('Table',"A",MINX(FILTER(ALL('Table'),[Case Type]="Preventive Maintenance"&amp;amp;&amp;amp;[System ID]=EARLIER([System ID])),[Date]))
var _t2 =DATEDIFF(MINX(_t,[A]),SELECTEDVALUE('Table'[Date]),DAY)
RETURN IF(_t2&amp;gt;0&amp;amp;&amp;amp;_t2&amp;lt;30&amp;amp;&amp;amp;MAX('Table'[Case Type])="Corrective Maintenance","red","")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope it helps!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&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;</description>
    <pubDate>Thu, 25 Apr 2024 06:24:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-04-25T06:24:15Z</dc:date>
    <item>
      <title>Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3861457#M150848</link>
      <description>&lt;P&gt;I have a list with unique system ID's who require periodic Preventive Maintenance. I would like to know whether for that same system ID there has been a Corrective Maintenance within one month after the Preventive Maintenance. So in the example table below, I would like to identify the case types in red, those are corrective maintenance cases that occured within a month after a preventive maintenance. How do I make this identification?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;System ID&lt;/TD&gt;&lt;TD&gt;Case Type&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Jan/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Jan/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Feb/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Feb/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Corrective Maintenance&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;25/Jan/24&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Mar/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Apr/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;Corrective Maintenance&lt;/TD&gt;&lt;TD&gt;02/Feb/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Corrective Maintenance&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;17/Feb/24&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/Apr/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/May/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;Preventive Maintenance&lt;/TD&gt;&lt;TD&gt;01/May/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;Corrective Maintenance&lt;/TD&gt;&lt;TD&gt;02/Jun/24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Corrective Maintenance&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;08/Apr/24&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;Corrective Maintenance&lt;/TD&gt;&lt;TD&gt;12/Jun/24&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 23 Apr 2024 07:40:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3861457#M150848</guid>
      <dc:creator>KvO88</dc:creator>
      <dc:date>2024-04-23T07:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3864500#M150968</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707504" data-lia-user-login="KvO88" class="lia-mention lia-mention-user"&gt;KvO88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made simple samples and you can check the results below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = var _t =ADDCOLUMNS('Table',"A",MINX(FILTER(ALL('Table'),[System ID]=EARLIER([System ID])),[Date]))
var _t2 =DATEDIFF(MINX(_t,[A]),SELECTEDVALUE('Table'[Date]),DAY)
RETURN IF(_t2&amp;gt;0&amp;amp;&amp;amp;_t2&amp;lt;30,"red","")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;An attachment for your reference. Hope it helps!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&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;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 07:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3864500#M150968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-24T07:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867286#M151069</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Thanks so much, this already helps a lot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is one thing that I still run in to, does the measure takes into account that I only want to see when a&amp;nbsp;&lt;U&gt;corrective maintenance&lt;/U&gt; is within a month after a&amp;nbsp;&lt;U&gt;preventive maintenance&lt;/U&gt;?&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like it checks all lines, despite the Case type.&amp;nbsp; Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 06:15:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867286#M151069</guid>
      <dc:creator>KvO88</dc:creator>
      <dc:date>2024-04-25T06:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867308#M151071</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707504" data-lia-user-login="KvO88" class="lia-mention lia-mention-user"&gt;KvO88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize for ignoring the extra condition, please try the following expression:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = var _t =ADDCOLUMNS('Table',"A",MINX(FILTER(ALL('Table'),[Case Type]="Preventive Maintenance"&amp;amp;&amp;amp;[System ID]=EARLIER([System ID])),[Date]))
var _t2 =DATEDIFF(MINX(_t,[A]),SELECTEDVALUE('Table'[Date]),DAY)
RETURN IF(_t2&amp;gt;0&amp;amp;&amp;amp;_t2&amp;lt;30&amp;amp;&amp;amp;MAX('Table'[Case Type])="Corrective Maintenance","red","")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Hope it helps!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&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;</description>
      <pubDate>Thu, 25 Apr 2024 06:24:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867308#M151071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-25T06:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867371#M151077</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Thanks! This works&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; One additional question, how can I convert this measure so that I get the counts of the number of Corrective Maintenances that occured within a month after Preventive?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 06:41:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867371#M151077</guid>
      <dc:creator>KvO88</dc:creator>
      <dc:date>2024-04-25T06:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867412#M151081</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707504" data-lia-user-login="KvO88" class="lia-mention lia-mention-user"&gt;KvO88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the following expression:&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 _t =ADDCOLUMNS('Table',"A",MINX(FILTER(ALL('Table'),[Case Type]="Preventive Maintenance"&amp;amp;&amp;amp;[System ID]=EARLIER([System ID])),[Date]))
var _t2 =DATEDIFF(MINX(_t,[A]),SELECTEDVALUE('Table'[Date]),DAY)
RETURN IF(_t2&amp;gt;0&amp;amp;&amp;amp;_t2&amp;lt;30&amp;amp;&amp;amp;MAX('Table'[Case Type])="Corrective Maintenance",COUNTROWS('Table'),"")
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Best regards,&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 06:51:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867412#M151081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-25T06:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867433#M151083</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Thank you for you quick replies! I really appreciate it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use a Card visual with this measure, I do not get a result....&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 06:58:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867433#M151083</guid>
      <dc:creator>KvO88</dc:creator>
      <dc:date>2024-04-25T06:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Check event occurred within set time of previous event of same unique ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867624#M151089</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="707504" data-lia-user-login="KvO88" class="lia-mention lia-mention-user"&gt;KvO88&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On top of that, add a measure:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 2 = 
SUMX(ALLSELECTED('Table'),[Measure])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Scott Chang&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 08:00:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Check-event-occurred-within-set-time-of-previous-event-of-same/m-p/3867624#M151089</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-25T08:00:26Z</dc:date>
    </item>
  </channel>
</rss>

