<?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 Counting days between a change in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days-between-a-change/m-p/4322544#M171610</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have measures for Percent, and Percent previous day. I also have a measure to flag if the daily change went up or down.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I am wanting to do is write a measure that counts the number of days between the start of each change, as shown in the image.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can you please assist me in helping to write this measure? Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2024 23:56:07 GMT</pubDate>
    <dc:creator>greenskmachine2</dc:creator>
    <dc:date>2024-12-10T23:56:07Z</dc:date>
    <item>
      <title>Counting days between a change</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days-between-a-change/m-p/4322544#M171610</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have measures for Percent, and Percent previous day. I also have a measure to flag if the daily change went up or down.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I am wanting to do is write a measure that counts the number of days between the start of each change, as shown in the image.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can you please assist me in helping to write this measure? Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 23:56:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days-between-a-change/m-p/4322544#M171610</guid>
      <dc:creator>greenskmachine2</dc:creator>
      <dc:date>2024-12-10T23:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days between a change</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days-between-a-change/m-p/4323063#M171629</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="706045" data-lia-user-login="greenskmachine2" class="lia-mention lia-mention-user"&gt;greenskmachine2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the following measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Consecutive Days Measure = 
VAR CurrentDate = MAX('Table'[Date])
VAR CurrentFlag = MAX('Table'[Percent Change Flag])

VAR PreviousDates =
    FILTER(
        ALL('Table'),
        'Table'[Date] &amp;lt; CurrentDate
    )

VAR LastChangeDate =
    MAXX(
        FILTER(
            PreviousDates,
            'Table'[Percent Change Flag] &amp;lt;&amp;gt; CurrentFlag
        ),
        'Table'[Date]
    )

VAR StartDate =
    IF(ISBLANK(LastChangeDate), MIN('Table'[Date]), LastChangeDate)

VAR ConsecutiveDays =
    DATEDIFF(StartDate, CurrentDate, DAY)

RETURN
IF(NOT ISBLANK(CurrentFlag), ConsecutiveDays, BLANK())
&lt;/LI-CODE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Joyce&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, 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, 11 Dec 2024 06:47:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days-between-a-change/m-p/4323063#M171629</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-11T06:47:14Z</dc:date>
    </item>
  </channel>
</rss>

