<?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: Conditional If statements including Dates in measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299509#M56763</link>
    <description>&lt;P&gt;Can you share your PBIX file or a sample of your data table and result that you are looking for in a text format?&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313840" data-lia-user-login="ruesaint_denis" class="lia-mention lia-mention-user"&gt;ruesaint_denis&lt;/a&gt;&amp;nbsp;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jan 2022 22:59:38 GMT</pubDate>
    <dc:creator>VahidDM</dc:creator>
    <dc:date>2022-01-24T22:59:38Z</dc:date>
    <item>
      <title>Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299304#M56744</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a measure that does the following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF:&lt;/P&gt;&lt;P&gt;Table['Order Created At'] &amp;gt;= Date(2022, 1, 19) &amp;amp;&amp;amp; Table['Company Name] = "Stripe"&lt;/P&gt;&lt;P&gt;then: 1500*[Num of Orders]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ELSE IF:&lt;/P&gt;&lt;P&gt;Table['Order Created At'] &amp;gt;= Date(2022, 1, 14):&lt;/P&gt;&lt;P&gt;then: 1000*[Num of Orders]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;else:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Blank&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially, if someone ordered "Stripe" on or after 1/19/2022, then calculate number of orders * 1500,&lt;/P&gt;&lt;P&gt;if someone ordered anything, regardless of company name, on or after 1/14/2022, then calculate number of orders * 1000.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I placed the 1/19 if statement before the 1/14 if statement, because I want that one to execute first.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would anyone know how this is possible for a &lt;STRONG&gt;measure&lt;/STRONG&gt;?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 20:07:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299304#M56744</guid>
      <dc:creator>ruesaint_denis</dc:creator>
      <dc:date>2022-01-24T20:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299331#M56746</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is an example on how to do this with test data:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Dax (the conditions are not excatly the same bu the logic is applicable):&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF measure = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_cdate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Deals[Created at]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_cdate&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;date&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;2020&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Deals[Opp Name]&lt;/SPAN&gt;&lt;SPAN&gt;)=&lt;/SPAN&gt;&lt;SPAN&gt;"Oracle"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_cdate&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;2020&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;11&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;End result:&lt;BR /&gt;&lt;img /&gt;&lt;P&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Jan 2022 20:25:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299331#M56746</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-24T20:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299343#M56751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, for some reason it's not working, and calculating everything currently as the Num of Orders*1000. It's not registering the Num of Orders*1500 clause:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF measure = 
var _cdate = MAX('Date Table'[Date]) 
return
IF(_cdate&amp;gt;DATE(2022,1,13),[Num of Orders (when placed, not incl canceled)]*1000,
IF(_cdate&amp;gt;date(2022,1,18)&amp;amp;&amp;amp;MAX('Orders'[Company Name])="Ripple",[Num of Orders (when placed, not incl canceled)]*1500,
BLANK()))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 20:44:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299343#M56751</guid>
      <dc:creator>ruesaint_denis</dc:creator>
      <dc:date>2022-01-24T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299474#M56756</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313840" data-lia-user-login="ruesaint_denis" class="lia-mention lia-mention-user"&gt;ruesaint_denis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this masure:&lt;/P&gt;&lt;P&gt;Measure =&amp;nbsp;&lt;BR /&gt;Var _DOC = MAX (&amp;nbsp;&lt;SPAN&gt;Table['Order Created At'] )&lt;BR /&gt;Var _CN = MAX ( Table['Company Name] )&lt;BR /&gt;Var _NO = [Num of Orders] -- if the Num of Orthers is Measure not column&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Var _Date1 =&amp;nbsp;Date(2022, 1, 19)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Var _Date2 =&amp;nbsp;Date(2022, 1, 14)&lt;BR /&gt;return&lt;BR /&gt;IF (&amp;nbsp;_DOC &amp;gt;= _Date1 &amp;amp;&amp;amp; _CN =&amp;nbsp;"Stripe", 1500*_NO ,IF (&amp;nbsp;Var _DOC &amp;gt;=&amp;nbsp;_Date2,&amp;nbsp;1000*_NO , BLANK() )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you face any issues, please share a sample of your data and the expected result in text format.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 22:13:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299474#M56756</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2022-01-24T22:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299503#M56761</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe the problem has to do with my data model?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;These are the measures I am using:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and how my tables would fit into one of your solutions:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF measure = 
Var _DOC = MAX ( 'Date Table'[Date] )
Var _CN = MAX ( Orders[Company Name])
Var _NO = [Num of Orders (when placed, not incl canceled)]
Var _Date1 = Date(2022, 1, 19)
Var _Date2 = Date(2022, 1, 14)
return
IF ( _DOC &amp;gt;= _Date1 &amp;amp;&amp;amp; _CN = "Ripple", 1500*_NO ,IF (_DOC &amp;gt;= _Date2, 1000*_NO , BLANK() ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it something to do with the inactive relationship between the date and order table that is messing with my ability to filter by Orders['Company Name']?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 22:50:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299503#M56761</guid>
      <dc:creator>ruesaint_denis</dc:creator>
      <dc:date>2022-01-24T22:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299509#M56763</link>
      <description>&lt;P&gt;Can you share your PBIX file or a sample of your data table and result that you are looking for in a text format?&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313840" data-lia-user-login="ruesaint_denis" class="lia-mention lia-mention-user"&gt;ruesaint_denis&lt;/a&gt;&amp;nbsp;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 22:59:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2299509#M56763</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2022-01-24T22:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional If statements including Dates in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2304485#M57011</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313840" data-lia-user-login="ruesaint_denis" class="lia-mention lia-mention-user"&gt;ruesaint_denis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can write the measure formula directly like this, the returned result is as you expect.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
IF (
    MAX ( 'Table'[Order Created At] ) &amp;gt;= DATE ( 2022, 1, 19 ),
    "Result1",
    IF (
        MAX ( 'Table'[Order Created At] ) &amp;gt;= DATE ( 2022, 1, 14 ),
        "Result2",
        "Result3"
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;Stephen Tao&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Accept it as the solution&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 07:12:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-If-statements-including-Dates-in-measure/m-p/2304485#M57011</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-27T07:12:02Z</dc:date>
    </item>
  </channel>
</rss>

