<?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: Trouble understanding Where Exists in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688965#M1078101</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;That was all very helpful. However, after fiddling around a bit, I found that my original plan isn't going to work without some additional work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Originally, two separate tables were merged into one, where the first data contains employee details, and the second table contains a registry of employee IDs that have leadership positions. The Leadership table is structured a bit strangely, where each leader is listed as many times as the number of employees he/she is leading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to merge the two tables, but using a left join (based on the large employee table) causes each leader to be listed as many times in the employee table as in the leader table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So right now I'm getting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee table:&lt;BR /&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where it should have been &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee table:&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sorry about the basic questions, but what should I do to avoid multiple listings?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The join code I have used is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FK_HR_EMPLOYEE_LEADER as FK_HR_EMPLOYEE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEADER_FLAG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;Y&gt;&lt;/Y&gt;&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jul 2014 09:28:16 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-07-17T09:28:16Z</dc:date>
    <item>
      <title>Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688961#M1078097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to create a table containing only the leaders of an organisation based on a table that contains all the employees in the organisation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in the big table, there is data like:&lt;BR /&gt;EmployeeID (One unique for each employee)&lt;/P&gt;&lt;P&gt;LeaderFlag (1 if the employee is a leader, 0 if not)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a smaller table with only the leaders. I have basically tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LeaderData:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;EmployeeID,&lt;/P&gt;&lt;P&gt;Employee.Surname_Firstname as Leader.Surname_Firstname&lt;/P&gt;&lt;P&gt;Resident Employee&lt;/P&gt;&lt;P&gt;Where Exists (LeaderFlag); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in no data in the LeaderData table. I tried to understand the Where Exists explanations in various posts in the forum, but I don't get it. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 13:30:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688961#M1078097</guid>
      <dc:creator />
      <dc:date>2014-07-16T13:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688962#M1078098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LeaderData:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;EmployeeID,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Employee.Surname_Firstname as Leader.Surname_Firstname&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident Employee&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where LeaderFlag = 1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where Exists determines whether a specific field value exists in a specified field of the data loaded so far.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 13:38:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688962#M1078098</guid>
      <dc:creator />
      <dc:date>2014-07-16T13:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688963#M1078099</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;EmployeeID,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Employee.Surname_Firstname as Leader.Surname_Firstname&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Resident Employee&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where LeaderFlag = 1;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Exists check that specified field values exists already in the previous table.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 13:38:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688963#M1078099</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2014-07-16T13:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688964#M1078100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Hello Tharald,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;There is a difference between 'WHERE' and 'WHERE EXISTS'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I guess if you would replace the last line into 'WHERE Leaderflag = 1;', your tabel will be loaded with only the leaders.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; To use where exists, you previously need to load a table based upon the key you want to use in the where exists function. See example below.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Map_Product_Scope_Temp_2:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%TempProdKey&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Map_Product_Scope_Temp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;NoConcatenate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;150:&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;LOAD&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;*&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;[$(vQVDTempPath)\$(vCurrentProduct)_$(vCurrentYear$(vCurrentProduct))_100.qvd]&lt;BR /&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Exists&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;%TempProdKey&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;); &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;This is used merely when you have 2 tables with no corresponding variables but the one you want to connect on. And when you want to load only a subset of this table. In your case, everything is in one table, so 'where exists' would be a detour. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Kind regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 13:39:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688964#M1078100</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2014-07-16T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688965#M1078101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;That was all very helpful. However, after fiddling around a bit, I found that my original plan isn't going to work without some additional work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Originally, two separate tables were merged into one, where the first data contains employee details, and the second table contains a registry of employee IDs that have leadership positions. The Leadership table is structured a bit strangely, where each leader is listed as many times as the number of employees he/she is leading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to merge the two tables, but using a left join (based on the large employee table) causes each leader to be listed as many times in the employee table as in the leader table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So right now I'm getting&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee table:&lt;BR /&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where it should have been &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee table:&lt;/P&gt;&lt;P&gt;LeaderID1,&lt;/P&gt;&lt;P&gt;LeaderID2,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sorry about the basic questions, but what should I do to avoid multiple listings?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The join code I have used is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FK_HR_EMPLOYEE_LEADER as FK_HR_EMPLOYEE,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LEADER_FLAG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;Y&gt;&lt;/Y&gt;&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 09:28:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688965#M1078101</guid>
      <dc:creator />
      <dc:date>2014-07-17T09:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688966#M1078102</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;If the number of employees in the 'employee details table' is correct, then don't use a join to combine both, but a mapping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leaders:&lt;/P&gt;&lt;P&gt;MAPPING LOAD DISTINCT&lt;/P&gt;&lt;P&gt;employee_ID,&lt;/P&gt;&lt;P&gt;1 as flag&lt;/P&gt;&lt;P&gt;FROM 'your leadership table'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then when you load the employee table&lt;/P&gt;&lt;P&gt;APPLYMAP('Leaders', employee_ID,0) as Leader&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will identify your leaders in the employee table, without multiplication. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 09:36:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688966#M1078102</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2014-07-17T09:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble understanding Where Exists</title>
      <link>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688967#M1078103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant! Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 08:34:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Trouble-understanding-Where-Exists/m-p/688967#M1078103</guid>
      <dc:creator />
      <dc:date>2014-07-18T08:34:36Z</dc:date>
    </item>
  </channel>
</rss>

