<?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: Measure to count differences between dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1445974#M27105</link>
    <description>&lt;LI-CODE lang="cpp"&gt;ReleasedToDate = CALCULATE(sum('Sharepoint Tracker'[ReleasedFlag]),FILTER(all('Sharepoint Tracker'),'Sharepoint Tracker'[Release Date]&amp;lt;=MAX('Sharepoint Tracker'[Planned Date].[Date])))&lt;/LI-CODE&gt;&lt;P&gt;think this code might work, but it is not the best.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 04:28:08 GMT</pubDate>
    <dc:creator>wdx223_Daniel</dc:creator>
    <dc:date>2020-10-21T04:28:08Z</dc:date>
    <item>
      <title>Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1419258#M26381</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a column that calculates how many rows have a 'Release Date' &amp;lt; the current row's 'Planned Date'.&amp;nbsp; I am then plotting this on a line chart.&amp;nbsp; This works well until a filter gets applied as the numbers in my column are based on unfiltered data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I presume the best way to get round this is with a Measure, however this fails with the 'Earlier' function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column formula is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ReleasedToDate = CALCULATE(sum('Sharepoint Tracker'[ReleasedFlag]),all('Sharepoint Tracker'),'Sharepoint Tracker'[Release Date]&amp;lt;=EARLIER('Sharepoint Tracker'[Planned Date].[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How should i go about being able to visulise this with filtered data please?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sam&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Oct 2020 21:11:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1419258#M26381</guid>
      <dc:creator>SamCoates</dc:creator>
      <dc:date>2020-10-07T21:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1419514#M26386</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="263444" data-lia-user-login="SamCoates" class="lia-mention lia-mention-user"&gt;SamCoates&lt;/a&gt; , if create date is less than planned date why need earlier &lt;/P&gt;
&lt;P&gt;This type of column should do&lt;/P&gt;
&lt;P&gt;if( [Release Date] &amp;lt;[planned date] ,1,0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure&lt;/P&gt;
&lt;P&gt;if( max([Release Date]) &amp;lt;Max([planned date]) ,1,0) &lt;/P&gt;
&lt;P&gt;But in case of measure you need row context, Like ID or sonething&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sumx(Values(Table[ID]),if( max([Release Date]) &amp;lt;Max([planned date]) ,1,0) )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer for row context&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 01:19:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1419514#M26386</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-10-08T01:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1420953#M26408</link>
      <description>&lt;P&gt;Hi, thanks a lot for your response, but unfortunately that doesn't work as I'd hoped.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am after a measure that tells me how many lines there are in the entire table that have a 'Released Date' &amp;lt; the current line's Planned Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The counter above will just tell me how many lines have a Release Date that is earlier thatn the Planned Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that possible with a measure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 10:03:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1420953#M26408</guid>
      <dc:creator>SamCoates</dc:creator>
      <dc:date>2020-10-08T10:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1444747#M27059</link>
      <description>&lt;P&gt;Bump&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any advice on how I should go about this please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 11:43:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1444747#M27059</guid>
      <dc:creator>SamCoates</dc:creator>
      <dc:date>2020-10-20T11:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1445974#M27105</link>
      <description>&lt;LI-CODE lang="cpp"&gt;ReleasedToDate = CALCULATE(sum('Sharepoint Tracker'[ReleasedFlag]),FILTER(all('Sharepoint Tracker'),'Sharepoint Tracker'[Release Date]&amp;lt;=MAX('Sharepoint Tracker'[Planned Date].[Date])))&lt;/LI-CODE&gt;&lt;P&gt;think this code might work, but it is not the best.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 04:28:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1445974#M27105</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2020-10-21T04:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1446797#M27126</link>
      <description>&lt;LI-CODE lang="csharp"&gt;ReleasedToDate =
sumx(
    filter(
        'Sharepoint Tracker',
        'Sharepoint Tracker'[Release Date]
            &amp;lt;= 'Sharepoint Tracker'[Planned Date]
    ),
    'Sharepoint Tracker'[ReleasedFlag]
)&lt;/LI-CODE&gt;&lt;P&gt;Please learn more about how DAX works. EARLIER is a function to use only within iterators that are executed within other iterators and these days there's no need to use it at all since there is a better mechanism: variables. This function is deprecated (see dax.guide).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, please stop using the auto-generated date hierarchies. They are only for complete newbies and make a lot of trouble in the end (not to mention they are taking space and you can't make one hierarchy filter other date columns in other tables). Always create your own calendar(s). ALWAYS.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 10:38:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1446797#M27126</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T10:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447239#M27140</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;, unfortunately your formula returns the total number of lines released before the largest date in the entire table, so it gives me a flat line for the current release total rather than showing what the total was on each day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thank you to&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;who on his way to misreading the question and delivering a solution that doesn't relate to the question - proved that manners cost nothing and being condescending makes you look a bit silly when you are unable to provide the solution yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Such a shame as most other users on here have been very helpful and polite, and don't see the need to belittle people's ability when they are simply asking more experienced users for assistance. (p.s. I am a 'Complete Newbie' and therefore don't see that as a derogatory term.&amp;nbsp; Sorry to hear that you do.)&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 13:57:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447239#M27140</guid>
      <dc:creator>SamCoates</dc:creator>
      <dc:date>2020-10-21T13:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447419#M27150</link>
      <description>&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="263444" data-lia-user-login="SamCoates" class="lia-mention lia-mention-user"&gt;SamCoates&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;You have read too much into my reply. There's nothing derogatory in my reply and all I typed in there is true. Even in Microsoft documentation they write that such hierarchies should only be used in the simplest of models and models that are 'quick and dirty,' never in production-ready ones. Sadly, most people that are new to PBI (newbies - I guess this is the right word?) do not know what a good model should look like and overuse the automatic hierarchies, which immediately leads to many problems.&lt;BR /&gt;&lt;BR /&gt;Therefore the usage of auto-generated hierarchies, unfortunately, often IS a sign that you most likely are a newbie. I can't see anything derogatory about this statement. It's just a fact of life.&lt;BR /&gt;&lt;BR /&gt;Sorry you have misread my intention.</description>
      <pubDate>Wed, 21 Oct 2020 15:24:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447419#M27150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T15:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447448#M27151</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// Assuming that there is
// a column in the table
// which uniquely identifies
// the rows, ItemID. T
// is your table.

// Due to the use of ALLSELECTED
// this measure must never be
// used in interators. It's a top-level
// measure.

[ReleasedToDate] =
if( hasonevalue( T[ItemID] ),
    var __plannedDate =
        selectedvalue( T[Planned Date] )
    var __count =
        calculate(
            countrows( T ),
            T[Release Date] &amp;lt; __plannedDate,
            allselected( T )
        )
    return
        __count
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 15:36:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447448#M27151</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-21T15:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Measure to count differences between dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447792#M27165</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;that set me on the right path.&amp;nbsp; I had to filter out any blank cells, and for some reason it was returning very few results when i used the unique ID field, not sure why.&amp;nbsp; However a few mods led me to this which works a treat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ReleaseCounter = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var __plannedDate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;selectedvalue( 'Sharepoint Tracker'[Planned Date] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var __count = &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;countrows( 'Sharepoint Tracker' ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'Sharepoint Tracker'[Release Date] &amp;lt;= __plannedDate,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;allselected( 'Sharepoint Tracker'),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;not(isblank('Sharepoint Tracker'[Release Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return __count&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 21 Oct 2020 19:42:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-to-count-differences-between-dates/m-p/1447792#M27165</guid>
      <dc:creator>SamCoates</dc:creator>
      <dc:date>2020-10-21T19:42:27Z</dc:date>
    </item>
  </channel>
</rss>

