<?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: sql condition in qlikview in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210149#M877810</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's never a good idea to try to translate 1:1 a (complex) SQL statement into a seemingly equivalent QlikView expression (User Interface only, right?). There is a better technique to get the same output from an expression: get the business rule behind these SQL queries. What do they intend to do? If you can describe that in plain text, an optimal QlikView expression will be easy to construct, will be easier to maintain, will be better performing, and last buyt not least - since you already described the business logic - it will be documented from the start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you describe what this code does?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Oct 2016 14:27:12 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2016-10-21T14:27:12Z</dc:date>
    <item>
      <title>sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210143#M877804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have the following sql query to calculate two fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: fuchsia;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: blue;"&gt;case&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt; &lt;SPAN style="color: blue;"&gt;when&lt;/SPAN&gt; [Customer Number] &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'UNKNOWN'&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;then&lt;/SPAN&gt; 0 &lt;SPAN style="color: blue;"&gt;else&lt;/SPAN&gt; 1 &lt;SPAN style="color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; [Number Of &lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customers&lt;/SPAN&gt;]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: fuchsia;"&gt;count&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: gray;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: blue;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt; &lt;SPAN style="color: blue;"&gt;case&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;when&lt;/SPAN&gt; [&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;Number] &lt;SPAN style="color: gray;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: red;"&gt;'UNKNOWN'&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;then&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;&lt;SPAN style="color: fuchsia;"&gt;concat&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;(&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[Date Of Birth]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[Gender]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;Address Line 1]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;Address Line 2]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;AddressLine 3]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer&lt;/SPAN&gt; Address Line 5]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;Postcode]&lt;SPAN style="color: gray;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas;"&gt;[&lt;SPAN style="font-family: Consolas; font-size: 12.6667px;"&gt;Customer &lt;/SPAN&gt;Country]&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i convert this to qlikview expression?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please someone help me with the exact expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210143#M877804</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210144#M877805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(If([Customer Number] = 'UNKNOWN', 0, 1) as [Number Of Customers],&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not so sure what the second statement is doing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 13:18:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210144#M877805</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-10-21T13:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210145#M877806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i tried '&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sum(If([Customer Number] = 'UNKNOWN', 0, 1) as [Number Of Customers],' inthe script , i m getting error as 'Nested aggregation not allowed'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 14:02:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210145#M877806</guid>
      <dc:creator />
      <dc:date>2016-10-21T14:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210146#M877807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you add a group by statement? Or may be all you want to do is create a flag and not do the sum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;If([Customer Number] = 'UNKNOWN', 0, 1)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I missed a parenthesis at the end in my last script line. I hope you added it before you ran it?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;Sum(If([Customer Number] = 'UNKNOWN', 0, 1)&lt;SPAN style="color: #ff0000; font-size: 14pt;"&gt;)&lt;/SPAN&gt; as [Number Of Customers],&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 14:04:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210146#M877807</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-10-21T14:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210147#M877808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have added the paranthesis &amp;amp; groupby before running.&lt;/P&gt;&lt;P&gt;still error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 14:06:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210147#M877808</guid>
      <dc:creator />
      <dc:date>2016-10-21T14:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210148#M877809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share your script and a screenshot of the error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 14:08:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210148#M877809</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-10-21T14:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: sql condition in qlikview</title>
      <link>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210149#M877810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's never a good idea to try to translate 1:1 a (complex) SQL statement into a seemingly equivalent QlikView expression (User Interface only, right?). There is a better technique to get the same output from an expression: get the business rule behind these SQL queries. What do they intend to do? If you can describe that in plain text, an optimal QlikView expression will be easy to construct, will be easier to maintain, will be better performing, and last buyt not least - since you already described the business logic - it will be documented from the start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you describe what this code does?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Oct 2016 14:27:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sql-condition-in-qlikview/m-p/1210149#M877810</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-10-21T14:27:12Z</dc:date>
    </item>
  </channel>
</rss>

