<?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: Minimum datediff per unique value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2966869#M99045</link>
    <description>&lt;P&gt;Hi &amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow these steps:&lt;BR /&gt;(1) Create a new measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIFF = 
DATEDIFF(CALCULATE(MAX('Table'[Date last used]),FILTER(ALL('Table'),'Table'[Cases] = MAX('Table'[Cases]))),TODAY(),DAY)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(2)Final output&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;Best Regards,&lt;BR /&gt;Gallen Luo&lt;BR /&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Dec 2022 03:02:55 GMT</pubDate>
    <dc:creator>v-jialluo-msft</dc:creator>
    <dc:date>2022-12-14T03:02:55Z</dc:date>
    <item>
      <title>Minimum datediff per unique value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2965635#M98965</link>
      <description>&lt;P&gt;Let's say i've got a couple of relevant columns:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Cases&lt;/TD&gt;&lt;TD&gt;Doc numbers&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Date last used&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;12-12-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;09-12-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;01-02-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;41&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;11-12-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10-12-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;63&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;05-12-22&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each case consists of a number of documents (could be 1 could be 100 etc). For each doc number i have a Date last used.&lt;/P&gt;&lt;P&gt;I calculated the difference between the last time a document was used and today.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is: I want a column added where for each case (so A, B and C etc) i see what the datediff is for the LAST used document in that case. How do I do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Edit: Explaination what i want with it:&lt;/P&gt;&lt;P&gt;It might help if you know why I want to do this: I want to generate a visualisation table with al cases where the datediff of the last used docname is bigger than a certain number. For instance I want to see al the cases A t/m C where the datediff between last used date and today is 180 and all the cases D t/m Z where this datediff is 230.&amp;nbsp;&lt;BR /&gt;I made a column that looks Yes/no = IF([datediff between date last updated and today]&amp;gt;[column with 180 for case A-C and 230 for case D-Z], "Yes", "no").&amp;nbsp;&lt;BR /&gt;This column i want to use to filter my page. I only want to see the cases where the Yes/no column gives Yes, because this are the cases where datedifference from the last used docname is larger than it should be.&lt;/P&gt;&lt;P&gt;BUT when i do it like this it gives me al the docnames within a case where the datediff surpasses 180 or 230 (for A and B). I don't want to know it per document, i want to know if the datediff of the LAST used docname in a case is higher than it should be..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Case&lt;/TD&gt;&lt;TD&gt;Minimum date diff&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 15:47:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2965635#M98965</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-13T15:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Minimum datediff per unique value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2966869#M99045</link>
      <description>&lt;P&gt;Hi &amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow these steps:&lt;BR /&gt;(1) Create a new measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DIFF = 
DATEDIFF(CALCULATE(MAX('Table'[Date last used]),FILTER(ALL('Table'),'Table'[Cases] = MAX('Table'[Cases]))),TODAY(),DAY)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(2)Final output&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;Best Regards,&lt;BR /&gt;Gallen Luo&lt;BR /&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 03:02:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2966869#M99045</guid>
      <dc:creator>v-jialluo-msft</dc:creator>
      <dc:date>2022-12-14T03:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Minimum datediff per unique value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2967441#M99087</link>
      <description>&lt;P&gt;You are the best! Added it as a meassure and used the meassure to calculate if a certain case is longer inactive than I want it to be and now it works! Thank you very much and have a nice day!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 08:44:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minimum-datediff-per-unique-value/m-p/2967441#M99087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-14T08:44:53Z</dc:date>
    </item>
  </channel>
</rss>

