<?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: Date duration with if stament in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994307#M100839</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="492525" data-lia-user-login="wmedin2022" class="lia-mention lia-mention-user"&gt;wmedin2022&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share the sample data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Dec 2022 04:38:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-12-30T04:38:49Z</dc:date>
    <item>
      <title>Date duration with if stament</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994293#M100837</link>
      <description>&lt;P&gt;Hi All, im stuck with the follwing DAX command on my power query. I want to Days Passed to calculate the duration in days based on the status. If status is "complete" then calculate duration from date to date complete. if &amp;lt;&amp;gt; complete then calculate date to current date or Today.I&lt;/P&gt;&lt;P&gt;&amp;nbsp;I get this error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expression.Error: 2 arguments were passed to a function which expects 1.&lt;BR /&gt;Details:&lt;BR /&gt;Pattern=&lt;BR /&gt;Arguments=[List]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= Table.AddColumn(#"Extracted Month Name", "Days_Passed", each if [Status] = "Complete" then&lt;BR /&gt;Duration.Days([Date], [Date Closed]) else Duration.Days([Date], DateTime.LocalNow()))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 03:57:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994293#M100837</guid>
      <dc:creator>wmedin2022</dc:creator>
      <dc:date>2022-12-30T03:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date duration with if stament</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994307#M100839</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="492525" data-lia-user-login="wmedin2022" class="lia-mention lia-mention-user"&gt;wmedin2022&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share the sample data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 04:38:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994307#M100839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-30T04:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date duration with if stament</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994385#M100842</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Duration.Days expects one argument, a difference between two dates, so you need to use a minus sign instead of a comma there. You also need to convert DateTime.LocalNow() from DateTime to Date. Try something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= Table.AddColumn(#"Extracted Month Name", "Days_Passed", each if[Status] = "Complete" then Duration.Days([Date Closed]-[Date]) else Duration.Days(DateTime.Date(DateTime.LocalNow())-[Date]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 06:47:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2994385#M100842</guid>
      <dc:creator>TomasAndersson</dc:creator>
      <dc:date>2022-12-30T06:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Date duration with if stament</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2995025#M100886</link>
      <description>&lt;P&gt;It works!!!&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 15:08:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-duration-with-if-stament/m-p/2995025#M100886</guid>
      <dc:creator>wmedin2022</dc:creator>
      <dc:date>2022-12-30T15:08:05Z</dc:date>
    </item>
  </channel>
</rss>

