<?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: How to write the Case statement with Coalesce function in Qlikview? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288701#M403244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems like your case can be simplified. You've already verified that Start_DT is null with your first condition, so then coalesce(Start_DT,'1800-01-01') seems like it would always return Start_DT. So your second condition is just checking that Start_DT &amp;lt; '2015-03-01' and Start_DT &amp;lt; '2016-10-25', but if the first part is true, the second part must also be true, so it simplifies further to just Start_DT &amp;lt; '2015-03-01'. Since that's our second condition, we'll only get to our third condition if it's &amp;gt;= '2015-03-01', so there's no need to check that, and the second part again simplifies to Start_DT &amp;lt; '2016-10-25'. So it seems your case statement reduces to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Case&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT is Null then Null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT &amp;lt; '2015-03-01' Then 'Yes'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT &amp;lt; '2016-10-25' Then 'No'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;END&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in QlikView, if Start_DT is null, then if we check that it's less than some value, this will be false, same as checking greater than a value. Null isn't a value. So in QlikView, we don't need to check that first condition. We can go straight to the date checks. I believe this would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if(Start_DT&amp;lt;makedate(2015, 3, 1),'Yes',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if(Start_DT&amp;lt;makedate(2016,10,25),'No'))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Dec 2016 20:23:28 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2016-12-28T20:23:28Z</dc:date>
    <item>
      <title>How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288696#M403239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings for the day!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to Qlikview and this blog. I am strucked with the below case statement to write in Qlikview. Though I have done my homework, couldn't find the correct solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me to resolve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case&lt;/P&gt;&lt;P&gt;When Start_DT is Null then Null&lt;/P&gt;&lt;P&gt;When Start_DT &amp;lt; '2015-03-01' and Coalesce(Start_DT,'1800-01-01') &amp;lt; '2016-10-25' Then 'Yes'&lt;/P&gt;&lt;P&gt;When Start_DT &amp;gt;= '2015-03-01' and Coalesce(Start_DT,'1800-01-01') &amp;lt; '2016-10-25' Then 'No'&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2016 08:12:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288696#M403239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-20T08:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288697#M403240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Try this, I heard &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Coalesce function is in Teradata which declares NVL in Oracle. Confirm the same and then try like below&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;If(Srart_DT = Null(), '',&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;If(Start_DT &amp;lt; MakeDate(2015-03-01) and If(WildMatch(Srart_DT, '1800-01-01') &amp;lt; MakeDate(2016-10-25)), 'Yes',&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;If(Start_DT &amp;gt;= MakeDate(2015-03-01) and If(WildMatch(Srart_DT, '1800-01-01') &amp;lt; MakeDate(2016-10-25)), 'No', '')))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2016 12:02:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288697#M403240</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2016-12-20T12:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288698#M403241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Len(Trim(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Start_DT)) = 0, Null(),&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Start_DT &lt;/SPAN&gt;&amp;lt; MakeDate(2015, 3, 1) and Alt(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Start_DT, MakeDate(1800, 1, 1)) &amp;lt; MakeDate(2016, 10, 25), 'Yes',&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Start_DT &amp;gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; MakeDate(2015, 3, 1) and Alt(&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;Start_DT, MakeDate(1800, 1, 1)) &amp;lt; MakeDate(2016, 10, 25), 'No')))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2016 12:16:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288698#M403241</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-20T12:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288699#M403242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the above, but getting the error like below &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If takes 2-3 parameters&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 05:55:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288699#M403242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-28T05:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288700#M403243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share a screenshot of your expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 10:47:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288700#M403243</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-28T10:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the Case statement with Coalesce function in Qlikview?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288701#M403244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems like your case can be simplified. You've already verified that Start_DT is null with your first condition, so then coalesce(Start_DT,'1800-01-01') seems like it would always return Start_DT. So your second condition is just checking that Start_DT &amp;lt; '2015-03-01' and Start_DT &amp;lt; '2016-10-25', but if the first part is true, the second part must also be true, so it simplifies further to just Start_DT &amp;lt; '2015-03-01'. Since that's our second condition, we'll only get to our third condition if it's &amp;gt;= '2015-03-01', so there's no need to check that, and the second part again simplifies to Start_DT &amp;lt; '2016-10-25'. So it seems your case statement reduces to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Case&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT is Null then Null&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT &amp;lt; '2015-03-01' Then 'Yes'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;When Start_DT &amp;lt; '2016-10-25' Then 'No'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;END&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in QlikView, if Start_DT is null, then if we check that it's less than some value, this will be false, same as checking greater than a value. Null isn't a value. So in QlikView, we don't need to check that first condition. We can go straight to the date checks. I believe this would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if(Start_DT&amp;lt;makedate(2015, 3, 1),'Yes',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;if(Start_DT&amp;lt;makedate(2016,10,25),'No'))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 20:23:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-write-the-Case-statement-with-Coalesce-function-in/m-p/1288701#M403244</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-12-28T20:23:28Z</dc:date>
    </item>
  </channel>
</rss>

