<?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 Loading max date with related data items in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-max-date-with-related-data-items/m-p/1774885#M591099</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am relatively new to QlikView scripting and am trying to use data load to restrict data items displayed in line with certain criteria.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple data columns with dates (from and to) as well as respective amount value, which indicate whether a task is valid or not.&lt;/P&gt;&lt;P&gt;Only rows where respective amount = 1 are valid and should be loaded. To add complexity I have multiple rows as each valid row can have more than one set of dates. As end result only one row per Person ID is expected.&lt;/P&gt;&lt;P&gt;I am trying to load data row if those conditions are met but am struggling with making Qlik respect the data structure from the entry point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summarising, there are few conditions I need to meet:&lt;/P&gt;&lt;P&gt;1) only load data items when Amount =1, i.e. if F1 Amount =1 or F2 Amount =1 - for each Person ID&lt;/P&gt;&lt;P&gt;2) once 1st condition is met, return data items related to row where from date is the most recent one.&amp;nbsp; So I need to select max(F1 from date) and the respective F1 to date, then max(F2 to from) and respective F2 to date.&lt;/P&gt;&lt;P&gt;As an example for the Person ID 1, I would like to get F1 from date = 01/04/2019, F1 to date = 23/03/2020, F2 from date = 11/12/2019, F2 to date = 14/03/2020.&lt;/P&gt;&lt;P&gt;I have tried few things but can't get it to work fully. I was able to restrict the load t values where the amount =1 but wasn't able to bring the correct To date for the max(FX from date).&lt;/P&gt;&lt;P&gt;I would be grateful for your suggestions.&lt;/P&gt;&lt;P&gt;Please see the example data attached.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emilia_siatrak_0-1610745120856.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/47153i6792D146DC5ADC54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="emilia_siatrak_0-1610745120856.png" alt="emilia_siatrak_0-1610745120856.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, Emilia&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2021 21:13:10 GMT</pubDate>
    <dc:creator>emilia_siatrak</dc:creator>
    <dc:date>2021-01-15T21:13:10Z</dc:date>
    <item>
      <title>Loading max date with related data items</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-max-date-with-related-data-items/m-p/1774885#M591099</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am relatively new to QlikView scripting and am trying to use data load to restrict data items displayed in line with certain criteria.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple data columns with dates (from and to) as well as respective amount value, which indicate whether a task is valid or not.&lt;/P&gt;&lt;P&gt;Only rows where respective amount = 1 are valid and should be loaded. To add complexity I have multiple rows as each valid row can have more than one set of dates. As end result only one row per Person ID is expected.&lt;/P&gt;&lt;P&gt;I am trying to load data row if those conditions are met but am struggling with making Qlik respect the data structure from the entry point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summarising, there are few conditions I need to meet:&lt;/P&gt;&lt;P&gt;1) only load data items when Amount =1, i.e. if F1 Amount =1 or F2 Amount =1 - for each Person ID&lt;/P&gt;&lt;P&gt;2) once 1st condition is met, return data items related to row where from date is the most recent one.&amp;nbsp; So I need to select max(F1 from date) and the respective F1 to date, then max(F2 to from) and respective F2 to date.&lt;/P&gt;&lt;P&gt;As an example for the Person ID 1, I would like to get F1 from date = 01/04/2019, F1 to date = 23/03/2020, F2 from date = 11/12/2019, F2 to date = 14/03/2020.&lt;/P&gt;&lt;P&gt;I have tried few things but can't get it to work fully. I was able to restrict the load t values where the amount =1 but wasn't able to bring the correct To date for the max(FX from date).&lt;/P&gt;&lt;P&gt;I would be grateful for your suggestions.&lt;/P&gt;&lt;P&gt;Please see the example data attached.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emilia_siatrak_0-1610745120856.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/47153i6792D146DC5ADC54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="emilia_siatrak_0-1610745120856.png" alt="emilia_siatrak_0-1610745120856.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, Emilia&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 21:13:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-max-date-with-related-data-items/m-p/1774885#M591099</guid>
      <dc:creator>emilia_siatrak</dc:creator>
      <dc:date>2021-01-15T21:13:10Z</dc:date>
    </item>
  </channel>
</rss>

