<?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: Help Moving a Set Analysis to Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-Moving-a-Set-Analysis-to-Load-Script/m-p/449483#M167745</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi OnePuttGirl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a potential solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have understood correctly you need to be able to calculate the number of employees you have in your business at the end of each month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will assume that your Employees table contains the following fields:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Employee ID&lt;/LI&gt;&lt;LI&gt;Employee Start Date&lt;/LI&gt;&lt;LI&gt;Employee Leave Date (Blank if employee is still employed)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You start by loading this table twice, once to capture the start dates and a second time to capture the leave dates.&amp;nbsp; The added 'Type' field allows this distinction to be achieved.&amp;nbsp; As part of this script you can establish common date fields with Month_Year being very useful for your particular analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You then use the group by function in mapping tables to count the number of starters and leavers in each Month_Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next you use the ApplyMap function to create a table that contains all the data you need in one place, i.e. &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Month_Year&lt;/LI&gt;&lt;LI&gt;Count of Starters for each Month_Year&lt;/LI&gt;&lt;LI&gt;Count of Leavers for each Month_Year&lt;/LI&gt;&lt;LI&gt;Calculated balance of starters-leavers&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally you need to set up a straight table adding the above-mentioned four fields as dimensions then use an expression to calculate the cumulative balance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression for calculating the cumulative balance is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rangesum(above(Total sum(Balance),0,RowNo(Total)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script to create the tables is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employees:&lt;/P&gt;&lt;P&gt;LOAD ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Start Date] as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Starters' as Type,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month([Start Date]) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year([Start Date]) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(MonthStart([Start Date]),'MMM-YYYY') as Month_Year&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Employees.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concatenate&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Leave Date] as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Leavers' as Type,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month([Leave Date]) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year([Leave Date]) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(MonthStart([Leave Date]),'MMM-YYYY') as Month_Year&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Employees.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starters_Map:&lt;/P&gt;&lt;P&gt;Mapping Load&lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;Count(ID) as Count_of_Starters&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Where Type='Starters'&lt;/P&gt;&lt;P&gt;Group By Month_Year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leavers_Map:&lt;/P&gt;&lt;P&gt;Mapping Load&lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;Count(ID) as Count_of_Leavers&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Where Type='Leavers'&lt;/P&gt;&lt;P&gt;Group By Month_Year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;Load distinct &lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;ApplyMap('Starters_Map',Month_Year,0) as Starters,&lt;/P&gt;&lt;P&gt;ApplyMap('Leavers_Map',Month_Year,0) as Leavers,&lt;/P&gt;&lt;P&gt;ApplyMap('Starters_Map',Month_Year,0)-ApplyMap('Leavers_Map',Month_Year,0) as Balance&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Order By Month_Year Asc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output from this example is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="382"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl24" height="29" width="98"&gt;Month_Year&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Starters&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Leavers&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Balance&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Cumulative Balance&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Sep-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Oct-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Nov-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Dec-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jan-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Feb-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Apr-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;May-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jun-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jul-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Aug-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Sep-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Oct-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2012 03:48:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-25T03:48:47Z</dc:date>
    <item>
      <title>Help Moving a Set Analysis to Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-Moving-a-Set-Analysis-to-Load-Script/m-p/449482#M167744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I need some help moving this set analysis to the load script. So I will use the Employees table as Resident and I will want to group by CalendarMonthName. Can someone construct this Set Analysis in Load script? I am going to build this for each month and it is a count of employees here at the end of each month. &lt;/P&gt;&lt;P&gt;TEMP:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(ClanedarMonthName) = 'Jan', &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count(EmployeeDirectory.ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where NLE_Period=vJanPer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is as far as I get because of the subtraction and addition that gets to happen. This set analysis works for expressions and now I get to put the fields in the script so that I can build a trending by month compared to other values. So I want a statement that accomplishing the same thing for each month. &lt;/P&gt;&lt;P&gt;if (([CalendarMonthName])='Jan',(count({&amp;lt;NLE_Period={'$(vJanPer)'}&amp;gt;}&amp;nbsp; EmployeeDirectory.ID))/(count(EmployeeDirectory.ID)-(Count ({&amp;lt;NLE_MonthEnd={'&amp;lt;=$(vJan)'},DOH_MonthEnd={'&amp;lt;=$(vJan)'}&amp;gt;}&amp;nbsp; EmployeeDirectory.ID)+(count({&amp;lt;DOH_Period={'&amp;gt;$(vJanPer)'}&amp;gt;}&amp;nbsp; EmployeeDirectory.ID))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESIDENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Employees&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;High Regards to anyone who assists me,&lt;/P&gt;&lt;P&gt;OnePuttGirl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 17:52:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-Moving-a-Set-Analysis-to-Load-Script/m-p/449482#M167744</guid>
      <dc:creator />
      <dc:date>2012-10-24T17:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help Moving a Set Analysis to Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-Moving-a-Set-Analysis-to-Load-Script/m-p/449483#M167745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi OnePuttGirl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a potential solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have understood correctly you need to be able to calculate the number of employees you have in your business at the end of each month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will assume that your Employees table contains the following fields:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Employee ID&lt;/LI&gt;&lt;LI&gt;Employee Start Date&lt;/LI&gt;&lt;LI&gt;Employee Leave Date (Blank if employee is still employed)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You start by loading this table twice, once to capture the start dates and a second time to capture the leave dates.&amp;nbsp; The added 'Type' field allows this distinction to be achieved.&amp;nbsp; As part of this script you can establish common date fields with Month_Year being very useful for your particular analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You then use the group by function in mapping tables to count the number of starters and leavers in each Month_Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next you use the ApplyMap function to create a table that contains all the data you need in one place, i.e. &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Month_Year&lt;/LI&gt;&lt;LI&gt;Count of Starters for each Month_Year&lt;/LI&gt;&lt;LI&gt;Count of Leavers for each Month_Year&lt;/LI&gt;&lt;LI&gt;Calculated balance of starters-leavers&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally you need to set up a straight table adding the above-mentioned four fields as dimensions then use an expression to calculate the cumulative balance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression for calculating the cumulative balance is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rangesum(above(Total sum(Balance),0,RowNo(Total)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script to create the tables is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employees:&lt;/P&gt;&lt;P&gt;LOAD ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Start Date] as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Starters' as Type,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month([Start Date]) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year([Start Date]) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(MonthStart([Start Date]),'MMM-YYYY') as Month_Year&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Employees.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concatenate&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Leave Date] as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Leavers' as Type,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month([Leave Date]) as Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year([Leave Date]) as Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(MonthStart([Leave Date]),'MMM-YYYY') as Month_Year&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Employees.xls&lt;/P&gt;&lt;P&gt;(biff, embedded labels, table is Sheet1$);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Starters_Map:&lt;/P&gt;&lt;P&gt;Mapping Load&lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;Count(ID) as Count_of_Starters&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Where Type='Starters'&lt;/P&gt;&lt;P&gt;Group By Month_Year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leavers_Map:&lt;/P&gt;&lt;P&gt;Mapping Load&lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;Count(ID) as Count_of_Leavers&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Where Type='Leavers'&lt;/P&gt;&lt;P&gt;Group By Month_Year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;Load distinct &lt;/P&gt;&lt;P&gt;Month_Year,&lt;/P&gt;&lt;P&gt;ApplyMap('Starters_Map',Month_Year,0) as Starters,&lt;/P&gt;&lt;P&gt;ApplyMap('Leavers_Map',Month_Year,0) as Leavers,&lt;/P&gt;&lt;P&gt;ApplyMap('Starters_Map',Month_Year,0)-ApplyMap('Leavers_Map',Month_Year,0) as Balance&lt;/P&gt;&lt;P&gt;Resident Employees&lt;/P&gt;&lt;P&gt;Order By Month_Year Asc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output from this example is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="382"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl24" height="29" width="98"&gt;Month_Year&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Starters&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Leavers&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Balance&lt;/TD&gt;&lt;TD class="xl24" style="border-left: none;" width="71"&gt;Cumulative Balance&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Sep-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Oct-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Nov-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Dec-2011&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jan-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Feb-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Apr-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;May-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jun-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Jul-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;16&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Aug-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Sep-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-3&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl25" height="17" style="border-top: none;"&gt;Oct-2012&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl26" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;-1&lt;/TD&gt;&lt;TD class="xl27" style="border-top: none; border-left: none;"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 03:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-Moving-a-Set-Analysis-to-Load-Script/m-p/449483#M167745</guid>
      <dc:creator />
      <dc:date>2012-10-25T03:48:47Z</dc:date>
    </item>
  </channel>
</rss>

