<?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 IF, and run DATEDIFF in formula in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741012#M36186</link>
    <description>&lt;P&gt;But how to show the result of DATEDIFF calculation if I put blank() ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 02:32:35 GMT</pubDate>
    <dc:creator>rocky_puff</dc:creator>
    <dc:date>2021-03-24T02:32:35Z</dc:date>
    <item>
      <title>Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1740897#M36180</link>
      <description>&lt;P&gt;Hi, im a new user in Power BI. Currently my task is to calculate the time difference between two dates, A and B, where supposed Date B is later than Date A. Since there are some technical error where Date A is later than Date B, it produces a negative result. Thus, now I need to do an IF to check if the Date A is later than Date B, return null, else run the calculation. But power BI is giving me an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unless, I didn't run the calculation, and I return string type, then it would work fine. And please let me know if I declare null correctly.&lt;/P&gt;&lt;P&gt;&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;Can anybody give some tips on the solution?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 01:09:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1740897#M36180</guid>
      <dc:creator>rocky_puff</dc:creator>
      <dc:date>2021-03-24T01:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1740943#M36183</link>
      <description>&lt;P&gt;You have to return the same datatype from all paths of the 'if' statement.&amp;nbsp; At the moment a string or a number are being returned.&amp;nbsp; Try blank()&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 02:04:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1740943#M36183</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2021-03-24T02:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741012#M36186</link>
      <description>&lt;P&gt;But how to show the result of DATEDIFF calculation if I put blank() ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 02:32:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741012#M36186</guid>
      <dc:creator>rocky_puff</dc:creator>
      <dc:date>2021-03-24T02:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741025#M36187</link>
      <description>&lt;P&gt;I haven't looked at the logic of the calculation. I'm just trying to get you past the error.&amp;nbsp; Replace "null" with blank()&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 02:35:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741025#M36187</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2021-03-24T02:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741252#M36191</link>
      <description>&lt;P&gt;IF you are creating the measure then use following DAX :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR ABC = SELECTEDVALUE('Table'[Start])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR BC = SELECTEDVALUE('Table'[End])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;SPAN&gt;IF(ABC&amp;lt;BC,DATEDIFF(ABC,BC,DAY),BLANK())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;else in a calculated column :&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Column = IF('Table'[Start]&amp;lt;'Table'[End],DATEDIFF('Table'[Start],'Table'[End],DAY),BLANK())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Mar 2021 05:22:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741252#M36191</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-24T05:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare Dates in IF, and run DATEDIFF in formula</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741299#M36192</link>
      <description>&lt;P&gt;Yes, I've tried like this before. But I had wrongly set the sequence and I didn't set the variable. Maybe that's why it run into error. But my solution is the same as this one, so I will mark this as a solution. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 05:49:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-Dates-in-IF-and-run-DATEDIFF-in-formula/m-p/1741299#M36192</guid>
      <dc:creator>rocky_puff</dc:creator>
      <dc:date>2021-03-24T05:49:39Z</dc:date>
    </item>
  </channel>
</rss>

