<?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: Use previous to compare data records from previous year and month in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763921#M719523</link>
    <description>&lt;P&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread. Thanks for&amp;nbsp;&lt;/FONT&gt;&lt;A href="https://www.tellpizzahut.one/" target="_self"&gt;&lt;FONT color="#000000"&gt;Pizza Hut Survey&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;. &lt;FONT color="#000000"&gt;Looking forward for solution .&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2020 04:29:11 GMT</pubDate>
    <dc:creator>Jessee1B</dc:creator>
    <dc:date>2020-11-25T04:29:11Z</dc:date>
    <item>
      <title>Use previous to compare data records from previous year and month</title>
      <link>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763015#M719520</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dashboard - Qlik Issue E.permanent.JPG" style="width: 641px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/44486i8BC27AB7F5FB566D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dashboard - Qlik Issue E.permanent.JPG" alt="Dashboard - Qlik Issue E.permanent.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Basically what i want to do about this data set is the following one&lt;/P&gt;&lt;P&gt;If the sameID appears in the previous year and month&amp;nbsp; with value &amp;gt;0 and appear also in current year with the previous month as well with value &amp;gt; 0 then it gets '1' in the column permanent staff.&lt;/P&gt;&lt;P&gt;I would like to do it in the script just to have a brand new column permanent staff but i don't know how i could do that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my script it is this&amp;nbsp;&lt;/P&gt;&lt;P&gt;// LIB CONNECT TO 'BO_DATABASE';&lt;/P&gt;&lt;P&gt;// LOAD YEAR,&lt;BR /&gt;// MONTH,&lt;BR /&gt;// ID,&lt;BR /&gt;// Value,&lt;BR /&gt;// if(ID = Previous(ID) and ANNEE = Previous(ANNEE)+1&lt;BR /&gt;// and MONTH = Previous(MONTH) and Value &amp;gt;0 and Previous(Value)&amp;gt;0, 1, 0) as PermanentStaff;&lt;/P&gt;&lt;P&gt;// [DATA_TABLE]:&lt;BR /&gt;// SELECT "YEAR",&lt;BR /&gt;// "MONTH",&lt;BR /&gt;// "ID",&lt;BR /&gt;// "Value"&lt;BR /&gt;// FROM SAP_BO_DATABASE;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// // UNTITITLE:&lt;BR /&gt;// // LOAD*,&lt;BR /&gt;// // if(ID = Previous(ID) and YEAR = Previous(YEAR)+1&lt;BR /&gt;// // and MONTH = Previous(MONTH) and Value &amp;gt;0 and Previous(Value)&amp;gt;0, 1, 0) as PermanentStaff&lt;BR /&gt;// // Resident [DATA_TABLE];&lt;BR /&gt;// // Drop Table [DATA_TABLE];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i get PermanentStaff field with zero value everytime.&lt;/P&gt;&lt;P&gt;Where i sample small data like this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Temp:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Load * Inline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ID, Year, Month, Value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;180, 2019, 1, 55&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;181, 2019, 2, 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;182, 2019, 3, 65&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;183, 2019, 4, 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;184, 2019, 5, 65&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;180, 2020, 1, 58&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;181, 2020, 2, 87&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;182, 2020, 3, 47&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;183, 2020, 4, 88&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;184, 2020, 5, 89&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I get the field "permanent staff" right but it doesn't come from a SAP BO Database.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ANyone could help me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:48:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763015#M719520</guid>
      <dc:creator>lessassy</dc:creator>
      <dc:date>2024-11-16T17:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Use previous to compare data records from previous year and month</title>
      <link>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763481#M719521</link>
      <description>&lt;P&gt;try this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Temp:
Load * Inline
[
ID, Year, Month, Value
180, 2019, 1, 55
181, 2019, 2, 0
182, 2019, 3, 65
183, 2019, 4, 0
184, 2019, 5, 65
180, 2020, 1, 58
181, 2020, 2, 87
182, 2020, 3, 47
183, 2020, 4, 88
184, 2020, 5, 89
];

//this builds the list of permanent IDs
NoConcatenate
T: load * Resident Temp; 
inner join (T) load ID, Year as LastYear, Month as LastMonth, Value as LastYearValue Resident T;
NoConcatenate Permanent: load ID, Year, Month, 1 as Permanent Resident T where Value &amp;gt; 0 and LastYearValue&amp;gt;0 and LastYear=Year-1 and LastMonth=Month;
left join (Temp) load ID, Year, Month, Permanent Resident Permanent;
drop table T, Permanent;&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 21 Nov 2020 23:19:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763481#M719521</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-11-21T23:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use previous to compare data records from previous year and month</title>
      <link>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763487#M719522</link>
      <description>&lt;P&gt;just realized month should be the same so a more efficient join will be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;inner join (T) load ID, Year as LastYear, Month, Value as LastYearValue Resident T;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and you wont need the check&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;and LastMonth=Month;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 00:10:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763487#M719522</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-11-22T00:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Use previous to compare data records from previous year and month</title>
      <link>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763921#M719523</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Thanks for the update and quick reply. I'll be sure to keep an eye on this thread. Looking for the same issue. Bumped into your thread. Thanks for&amp;nbsp;&lt;/FONT&gt;&lt;A href="https://www.tellpizzahut.one/" target="_self"&gt;&lt;FONT color="#000000"&gt;Pizza Hut Survey&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;. &lt;FONT color="#000000"&gt;Looking forward for solution .&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 04:29:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-previous-to-compare-data-records-from-previous-year-and/m-p/1763921#M719523</guid>
      <dc:creator>Jessee1B</dc:creator>
      <dc:date>2020-11-25T04:29:11Z</dc:date>
    </item>
  </channel>
</rss>

