<?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 Less than Date operator with Dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882555#M40468</link>
    <description>&lt;P&gt;This is probably going to wind up being something simple.&amp;nbsp; I have two tables that I'm using in a measure. There is only an inactive relationship between the two, and I'm not activating the relationship.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1 is SQLBI's Dax Calendar&lt;/P&gt;&lt;P&gt;Table 2 is a list of projected values. Because they're projected, the same target month may have multiple values, and I only want to show the projected value from the last month before. (i.e. what'd we say the value was going to be for this month, last month)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is that while my first variable correctly identifies the first of the month on my axis, the variable that determines what the most recent projection month is "prior to this month" is returning the same month, rather than the previous month. My Less than doesn't seem to be working 4/1/2021 isn't "Less than" 4/1/2021".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this because my calculate's filter statement is working against the same column that I'm trying to return or does it have something to due with the time values.&amp;nbsp; Both columns are identified as "Date" types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Projected Value in Period = 
    VAR DateInView = MIN('Date'[Date]) 
    VAR MostRecentProjection = 
        CALCULATE(
            MAX('Projected Revenue'[Projection Month]),
            'Projected Revenue'[Projection Month] &amp;lt; DateInView
        )
    RETURN
        MostRecentProjection&lt;/LI-CODE&gt;&lt;P&gt;For May 2021, I my goal was the returned valued to be "4/1/2021". Because May is the last month that any projections exist, June and later work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/527769i3EC5192EFBA0FA8F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" alt="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is Table 2 for the "May and June" values&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Projection Month&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Wednesday, July 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Wednesday, July 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, August 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, August 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tuesday, September 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tuesday, September 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Monday, February 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Monday, March 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Thursday, April 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, May 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Fri, 04 Jun 2021 14:19:18 GMT</pubDate>
    <dc:creator>jnickell</dc:creator>
    <dc:date>2021-06-04T14:19:18Z</dc:date>
    <item>
      <title>Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882555#M40468</link>
      <description>&lt;P&gt;This is probably going to wind up being something simple.&amp;nbsp; I have two tables that I'm using in a measure. There is only an inactive relationship between the two, and I'm not activating the relationship.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1 is SQLBI's Dax Calendar&lt;/P&gt;&lt;P&gt;Table 2 is a list of projected values. Because they're projected, the same target month may have multiple values, and I only want to show the projected value from the last month before. (i.e. what'd we say the value was going to be for this month, last month)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My issue is that while my first variable correctly identifies the first of the month on my axis, the variable that determines what the most recent projection month is "prior to this month" is returning the same month, rather than the previous month. My Less than doesn't seem to be working 4/1/2021 isn't "Less than" 4/1/2021".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this because my calculate's filter statement is working against the same column that I'm trying to return or does it have something to due with the time values.&amp;nbsp; Both columns are identified as "Date" types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Projected Value in Period = 
    VAR DateInView = MIN('Date'[Date]) 
    VAR MostRecentProjection = 
        CALCULATE(
            MAX('Projected Revenue'[Projection Month]),
            'Projected Revenue'[Projection Month] &amp;lt; DateInView
        )
    RETURN
        MostRecentProjection&lt;/LI-CODE&gt;&lt;P&gt;For May 2021, I my goal was the returned valued to be "4/1/2021". Because May is the last month that any projections exist, June and later work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/527769i3EC5192EFBA0FA8F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" alt="2021-06-04 09_06_54-Zahner_MasterAnalyticalModel - Power BI Desktop.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is Table 2 for the "May and June" values&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Projection Month&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Wednesday, July 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Wednesday, July 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, August 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, August 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tuesday, September 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Tuesday, September 1, 2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Monday, February 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Monday, March 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Thursday, April 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Saturday, May 1, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:19:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882555#M40468</guid>
      <dc:creator>jnickell</dc:creator>
      <dc:date>2021-06-04T14:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882581#M40471</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/20102"&gt;@jnickell&lt;/a&gt;&amp;nbsp;Perhaps try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Projected Value in Period = 
    VAR DateInView = MIN('Date'[Date]) 
    VAR MostRecentProjection = 
        MAXX(
            FILTER(ALL('Project Revenue),'Project Revenue'[Project Month] &amp;lt; DateInView),
            'Projected Revenue'[Projection Month]
        )
    RETURN
        MostRecentProjection&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:35:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882581#M40471</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-06-04T14:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882594#M40472</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313"&gt;@Greg_Deckler&lt;/a&gt;&amp;nbsp;Thanks for the reply.&amp;nbsp; I tried that and it introduces the same problem, and for June and later it shows 6/1/2021 instead of the May 2021 value I would want to use.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:41:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882594#M40472</guid>
      <dc:creator>jnickell</dc:creator>
      <dc:date>2021-06-04T14:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882612#M40473</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313"&gt;@Greg_Deckler&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Scratch that I had an additional filter on my dates that seems to have allowed that to work. Removing the filter on the Axis reintroduced the error.&amp;nbsp;&lt;BR /&gt;&lt;STRIKE&gt;So working on the theory that it has something to with "time" values I tried this (forcing the Date values to integers before comparing) and it gets me the result I was expecting.&amp;nbsp; This seems like a cludge though.&amp;nbsp; Thoughts on what I should be doing?&lt;/STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    VAR DateInView = CONVERT(MIN('Date'[Date]),INTEGER)
    VAR MostRecentProjection = 
        CALCULATE(
            MAX('Projected Revenue'[Projection Month]),
            Convert('Projected Revenue'[Projection Month],INTEGER) &amp;lt; DateInView
        )
    RETURN
        MostRecentProjection&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2021-06-04 09_54_32-Zahner_MasterAnalyticalModel - Power BI Desktop.png" style="width: 642px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/527790iFF18E456EC92283F/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-06-04 09_54_32-Zahner_MasterAnalyticalModel - Power BI Desktop.png" alt="2021-06-04 09_54_32-Zahner_MasterAnalyticalModel - Power BI Desktop.png" /&gt;&lt;/span&gt;&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 14:59:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882612#M40473</guid>
      <dc:creator>jnickell</dc:creator>
      <dc:date>2021-06-04T14:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882862#M40482</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/20102"&gt;@jnickell&lt;/a&gt;&amp;nbsp;Going to need sample data to mock this up. Here is my standard "more information" macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 19:32:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882862#M40482</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-06-04T19:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Less than Date operator with Dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882918#M40486</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313"&gt;@Greg_Deckler&lt;/a&gt;&amp;nbsp;I wound up deleting my test visual and recreating it and the issue didn't represent. Don't know if I had a filter I wasn't seeing or a bad cache of something. Don't have an explanation for what I was seeing, but it's not happening now.&amp;nbsp; Thanks for your responses.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 20:58:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Less-than-Date-operator-with-Dates/m-p/1882918#M40486</guid>
      <dc:creator>jnickell</dc:creator>
      <dc:date>2021-06-04T20:58:42Z</dc:date>
    </item>
  </channel>
</rss>

