<?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: using a where clause in QlikView syntax in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092776#M644686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add a Where Clause to the end of the statement you just have to work with the Qlik specific syntax for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could write the WHERE clause like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;WHERE&lt;/STRONG&gt; pos &amp;gt; 19 &lt;STRONG&gt;AND&lt;/STRONG&gt; pos &amp;lt; 24&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jan 2016 20:13:43 GMT</pubDate>
    <dc:creator>ryanridley</dc:creator>
    <dc:date>2016-01-14T20:13:43Z</dc:date>
    <item>
      <title>using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092775#M644685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone please help?&amp;nbsp; I am trying to count unique ER visits per patient in a dataset.&amp;nbsp; In SQL it is a simple query that does a distinct count of claims when the place of service is the ER or Urgent Care.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select pat_id, count (distinct IMPUTED_CLAIMNO) 'ER Visits'&lt;/P&gt;&lt;P&gt;from [dbo].[OvarianCA_Year3_Claims]&lt;/P&gt;&lt;P&gt;where pos in ('20','23')&lt;/P&gt;&lt;P&gt;group by pat_id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It runs very quickly and accurately in sql server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can get the distinct count of claims in QlikView&amp;nbsp; Count (DISTINCT IMPUTED_CLAIMNO)&amp;nbsp; but for the life of me I have been unable to figure out how to add the where clause portion of this.&amp;nbsp; I have read multiple answers and it looks like a comma followed by the syntax is needed but it also looks like there is a specific sequence of {, ( or other characters that are needed and I just do not understand or see what that is.&amp;nbsp; I have spent hours on this only to see error in expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not a difficult query and I could create a separate table for Qlik but there is no reason for that.&amp;nbsp; The data are all there in that table which was ported from SQL Server to Qlik.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any guidance you can provide.&amp;nbsp;&amp;nbsp; Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 17:02:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092775#M644685</guid>
      <dc:creator />
      <dc:date>2016-01-14T17:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092776#M644686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add a Where Clause to the end of the statement you just have to work with the Qlik specific syntax for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could write the WHERE clause like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;WHERE&lt;/STRONG&gt; pos &amp;gt; 19 &lt;STRONG&gt;AND&lt;/STRONG&gt; pos &amp;lt; 24&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 20:13:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092776#M644686</guid>
      <dc:creator>ryanridley</dc:creator>
      <dc:date>2016-01-14T20:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092777#M644687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jan 2016 22:41:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092777#M644687</guid>
      <dc:creator />
      <dc:date>2016-01-14T22:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092778#M644690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks again for responding.&amp;nbsp; Unfortunately this did not work.&amp;nbsp; Even if I try to filter the result by adding pos=20 (or pos='20' I still get no results though it calculates fine without the filter.&amp;nbsp; I still think this looks to be a syntax issue of some sort and I am just not getting it.&amp;nbsp; Have actually combed through the community responses about analysis sets, filters, where clauses and read a slew of responses and examples but I am still not getting it and I have not found a good source that outlines the syntax that QlikView expects.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will keep searching and post here if I find it.&amp;nbsp; Any and all other suggestions welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jan 2016 12:10:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092778#M644690</guid>
      <dc:creator />
      <dc:date>2016-01-16T12:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092779#M644692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well I think I was able to figure this out on my own... with the help of reading a lot of other folks questions and answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was trying to show the unique patients, costs, and number of unique ER visits in a dataset where ER and Urgent Care are identified by a point of service code of 20 or 23.&amp;nbsp; You cannot use a range because there are values between 20 and 23 that do not correspond to the correct pos code but I could not get the range to work anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I came up with is probably not elegant but it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; I created a calculated dimension&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=If(Service_Category= 'ER/Urgent Care', [Service_Category])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Counting patients was easy&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count (DISTINCT pat_id)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I changed the name of the allowed $ field in a subtable to be able to call it directly&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum (Macroeconomic_Allowed$)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. I finally found an answer using inclusions and exclusions that did the trick for the count of er visits&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count ( {&amp;lt;IMPUTED_CLAIMNO= p({&amp;lt;pos={'20','23'}&amp;gt;}IMPUTED_CLAIMNO) &amp;gt;}DISTINCT IMPUTED_CLAIMNO)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not pretty and it took me too long for something that takes less than a minute to write and run in SQL but at least it works and I learned something.&amp;nbsp; Hopefully as knowledge of QlikView increases I will find, or you will provide, a more efficient way of getting there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It was a syntax issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jan 2016 14:35:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092779#M644692</guid>
      <dc:creator />
      <dc:date>2016-01-16T14:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092780#M644694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should also work for 4. if it's from a table like mentioned in your initial post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count ({&amp;lt; pos={'20','23'}&amp;gt;} DISTINCT IMPUTED_CLAIMNO)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jan 2016 17:46:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092780#M644694</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-01-16T17:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: using a where clause in QlikView syntax</title>
      <link>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092781#M644695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;regarding your first question&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Select pat_id, count (distinct IMPUTED_CLAIMNO) 'ER Visits'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;from [dbo].[OvarianCA_Year3_Claims]&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;where pos in ('20','23')&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;group by pat_id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can make a chart (straight table) with pat_id as dimension and count(distinct IMPUTED_CLAIMNO) as expression&lt;/P&gt;&lt;P&gt;also add a listbox for pos and in few seconds you can query the qlik database and get (I think) all your answers without the need to change a SQL query, just click on the values you want to filter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding your second question , if you can, post your .qvw or a small example.&lt;/P&gt;&lt;P&gt;You don't have to create in Qlik the same single SQL query but a database that you can use to discover the data; every time you click (filter) in Qlik you're querying the Qlik db. Don't try to create a single SQL query in Qlik.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jan 2016 18:28:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/using-a-where-clause-in-QlikView-syntax/m-p/1092781#M644695</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-01-16T18:28:03Z</dc:date>
    </item>
  </channel>
</rss>

