<?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: Compare dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1269848#M21372</link>
    <description>&lt;P&gt;If you use a date column from the same table in your slicer, it filters that table and prevents your desired functionality.&amp;nbsp; You can make a simple DAX table to be used in your slicer instead, then store the selectedvalue in a variable for comparison in the rest of your expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SlicerDates = DISTINCT('NPLM Import'[Plan &lt;A href="mailto:R@R" target="_blank"&gt;R@R&lt;/A&gt;&amp;nbsp;...])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Ø Annual Turnover (EUR) Done = 
var thisdate = SELECTEDVALUE(SlicerDates[Plan R@R ...])
Return 
IF(
   MAX('NPLM Import'[Plan R@R (internal) Date]) &amp;gt;= thisdate, 
      IFERROR(SUM('NPLM Import'[Yearly average turnover (EUR)]), "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
    <pubDate>Tue, 04 Aug 2020 00:02:46 GMT</pubDate>
    <dc:creator>mahoneypat</dc:creator>
    <dc:date>2020-08-04T00:02:46Z</dc:date>
    <item>
      <title>Compare dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1268717#M21329</link>
      <description>&lt;P class="lia-align-left"&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my aim is&amp;nbsp;to compare two dates within an if clause.&lt;/P&gt;&lt;P&gt;Naturally, the formula should show all values, if their date is larger than my selected date (03.08.2020).&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But I don't know why the following dax is not working&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Ø Annual Turnover (EUR) Done = 
IF(
   MAX('NPLM Import'[Plan R@R (internal) Date]) &amp;gt;= (DATE(MAX(Dates[Year]), MAX(Dates[MonthOfYear]), 1+MAX(Dates[DayOfMonth]))), 
      IFERROR(SUM('NPLM Import'[Yearly average turnover (EUR)]), "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Replacing the part after &amp;gt;= with MAX('Dates'[Date]) oder SELECTEDVALUE('Dates'[Date]) is either giving me no values or shows all values.&lt;/P&gt;&lt;P&gt;It works fine when I replace it with a date(2020,08,03) or today(), but I need to have it dynamically with a date slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Ø Annual Turnover (EUR) Done = 
IF(
   MAX('NPLM Import'[Plan R@R (internal) Date]) &amp;gt;= (DATE(2020,08,03)), 
      IFERROR(SUM('NPLM Import'[Yearly average turnover (EUR)]), "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to avoid this bug?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 13:53:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1268717#M21329</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-03T13:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1269839#M21369</link>
      <description>&lt;P&gt;What happens when&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dates[DayOfMonth]&lt;/PRE&gt;&lt;P&gt;is 31 ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may want to use variables to debug you measure and see where it breaks.&lt;/P&gt;&lt;P&gt;By the way, generally you can just say max(date)+1 or you can use DATEADD()&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 23:44:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1269839#M21369</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-08-03T23:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compare dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1269848#M21372</link>
      <description>&lt;P&gt;If you use a date column from the same table in your slicer, it filters that table and prevents your desired functionality.&amp;nbsp; You can make a simple DAX table to be used in your slicer instead, then store the selectedvalue in a variable for comparison in the rest of your expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SlicerDates = DISTINCT('NPLM Import'[Plan &lt;A href="mailto:R@R" target="_blank"&gt;R@R&lt;/A&gt;&amp;nbsp;...])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Ø Annual Turnover (EUR) Done = 
var thisdate = SELECTEDVALUE(SlicerDates[Plan R@R ...])
Return 
IF(
   MAX('NPLM Import'[Plan R@R (internal) Date]) &amp;gt;= thisdate, 
      IFERROR(SUM('NPLM Import'[Yearly average turnover (EUR)]), "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this works for you, please mark it as the solution.&amp;nbsp; Kudos are appreciated too.&amp;nbsp; Please let me know if not.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pat&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 00:02:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-dates/m-p/1269848#M21372</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-08-04T00:02:46Z</dc:date>
    </item>
  </channel>
</rss>

