<?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: DATEDIFF When Usinf IF Argument in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949883#M10600</link>
    <description>&lt;P&gt;So basicaly I need to make one of three different calculations based on the record source.&amp;nbsp; If the record source is from an audit it can be either one of the two calculations but if the record source is a quality issue use that calculation.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Feb 2020 22:17:44 GMT</pubDate>
    <dc:creator>RichBurdick</dc:creator>
    <dc:date>2020-02-26T22:17:44Z</dc:date>
    <item>
      <title>DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949758#M10589</link>
      <description>&lt;P&gt;I am trying to wrote a DAX measurement where based on the text value of a column use these two date fields to calculate days.&lt;/P&gt;&lt;P&gt;I have been able to figure out the DATEDIFF part of the measurement but have been running into issues with the IF.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the measurement:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CAPA Planning Days = IF(CAPATable[Record_Source] = “Audit”), (DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY))&lt;/LI-CODE&gt;&lt;P&gt;The DateDiff works fine but could use some assistance&amp;nbsp;on the IF part&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 20:48:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949758#M10589</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-26T20:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949766#M10590</link>
      <description>&lt;P&gt;Well, if this is a measure, you are going to need to have an aggregation like MIN or MAX around your column. I think you want something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CAPA Planning Days = 
  IF(
    MAX(CAPATable[Record_Source]) = “Audit”, // true/false statement
    DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY), //true
    "This is the false part" //false
  )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Feb 2020 20:56:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949766#M10590</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-26T20:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949779#M10592</link>
      <description>&lt;P&gt;Thanks for the response but when I enter the new argument I get the following error message: Too few arguments were passed to the IF function. The minimum argument count for the function is 2.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 21:08:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949779#M10592</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-26T21:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949861#M10597</link>
      <description>&lt;P&gt;Maybe more information would help.&amp;nbsp; I am trying to create a measure with the following criteria&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;If Record Source = Audit
(DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY)) and
(DATEDIFF(MIN(CAPAtable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY))
OR
If Record Source = Quality Issue
(DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED], MAX(CAPATable[CAPA_PLAN_APPROVAL_ON]), DAY))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Feb 2020 22:01:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949861#M10597</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-26T22:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949879#M10599</link>
      <description>&lt;P&gt;So that generally means there is a missing paren somewhere. I do not understand your last post at all. If the record source = audit then a datediff and another datediff? I am not understanding something. Are you adding those datediffs together?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 22:14:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949879#M10599</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-26T22:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949883#M10600</link>
      <description>&lt;P&gt;So basicaly I need to make one of three different calculations based on the record source.&amp;nbsp; If the record source is from an audit it can be either one of the two calculations but if the record source is a quality issue use that calculation.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 22:17:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949883#M10600</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-26T22:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949888#M10601</link>
      <description>&lt;P&gt;OK, so what is the criteria for which calculation to use for Audit?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 22:20:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949888#M10601</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-26T22:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949895#M10602</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to use both.&amp;nbsp; Maybe there is a better function or order to use.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;If Record Source = Audit
(DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY)) 
OR
If Record Source = Audit
(DATEDIFF(MIN(CAPAtable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY))
OR
If Record Source = Quality Issue
(DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED], MAX(CAPATable[CAPA_PLAN_APPROVAL_ON]), DAY))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Feb 2020 22:24:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949895#M10602</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-26T22:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949951#M10605</link>
      <description>&lt;P&gt;Right but when do you use one versus the other? For Audit.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 23:46:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949951#M10605</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-26T23:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949965#M10606</link>
      <description>&lt;P&gt;Sorry, I guess that would help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;If Record Source = Audit and Status = Closed-Done
(DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY)) 
OR
If Record Source = Audit and Status – Closed- Correction
(DATEDIFF(MIN(CAPAtable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY))
OR
If Record Source = Quality Issue
(DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED], MAX(CAPATable[CAPA_PLAN_APPROVAL_ON]), DAY))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 00:07:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/949965#M10606</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-27T00:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950053#M10608</link>
      <description>&lt;P&gt;OK, I think that I would do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CAPA Planning Days = 
  VAR __RecordSource = MAX(CAPATable[Record_Source])
  VAR __Status = MAX(CAPATable[Status])
RETURN
  SWITCH(
    TRUE(),
    __RecordSource = "Audit" &amp;amp;&amp;amp; __Status = "Closed-Door",DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CAPAPlanFirstApproval[FirstDate]), DAY),
    __RecordSource = "Audit" &amp;amp;&amp;amp; __Status = "Closed-Correction",DATEDIFF(MIN(CAPATable[DATE_OPENED]), MAX(CorrFirstApproval[FirstDate]), DAY),
    __RecordSource = "Quaity Issue",DATEDIFF(MIN(CAPARequiredTable[DATE_PERFORMED]), MAX(CAPAPTable[CAPA_PLAN_APPROVAL_ON]), DAY),
    BLANK()
  )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 02:03:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950053#M10608</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-27T02:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950264#M10616</link>
      <description>&lt;P&gt;Thank you so much for the help.&amp;nbsp; I have been racking my brain for hours on this. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 04:59:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950264#M10616</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-27T04:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950292#M10618</link>
      <description>&lt;P&gt;Hope it worked for you!!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 05:21:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/950292#M10618</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-02-27T05:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: DATEDIFF When Usinf IF Argument</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/951147#M10680</link>
      <description>&lt;P&gt;Quick follow up queston. I am seeing a problem with the calculation, is there anything special I need to do if using a Summary Table in my calculation ?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 14:53:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEDIFF-When-Usinf-IF-Argument/m-p/951147#M10680</guid>
      <dc:creator>RichBurdick</dc:creator>
      <dc:date>2020-02-27T14:53:28Z</dc:date>
    </item>
  </channel>
</rss>

