<?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: Get FirstValue of next Month script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1671102#M594946</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD Date,
	 text(Date(Date,'YYYYMM'))as Month, 
     Value
FROM
[C:\Users\jfong2\Downloads\Example.xlsx]
(ooxml, embedded labels, table is Data);

MonthLoop:
load
distinct
Month
resident Data;

let vRow =NoOfRows('MonthLoop');
for i=1 to '$(vRow)'


let vMonth =peek('Month',$(i),'MonthLoop');
Data2:
load Date(min(Date),'DD/MM/YYYY')as Date2,
	1 as Flag
	resident Data
	where Value&amp;gt;0
	and Month='$(vMonth)'
	group by
	Month;
next i

left join(Data2)
load Date as Date2,
	date(Date,'YYYYMM') as YearPeriod, 
     Value  resident Data;
     
drop table Data;
DROP TABLE MonthLoop;

NoConcatenate
Data3:
load TEXT(DATE(addmonths(YearPeriod,-1),'YYYYMM')) as YearPeriod,
	 Value as NextMonthValue,
	 Flag
resident Data2;
 
join(Data3)
load Date2,
	 Year(Date2)as Year,text(YearPeriod) as YearPeriod,
	 Value,
	 Flag resident Data2;
drop table Data2;

exit SCRIPT;&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 31 Jan 2020 00:55:40 GMT</pubDate>
    <dc:creator>Arthur_Fong</dc:creator>
    <dc:date>2020-01-31T00:55:40Z</dc:date>
    <item>
      <title>Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1663786#M594941</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;Actually I have the next Code that get the last value of actual month.&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Date(Max(Date_Value)) as Fecha_Go,&lt;BR /&gt;Period_Go as Period,&lt;BR /&gt;FirstSortedValue(U_GO, -Date_Value) as GO&lt;/P&gt;&lt;P&gt;Resident Tabla_B&lt;BR /&gt;Where len(U_GO)&amp;gt; 0&lt;BR /&gt;Group By Period_Go ;&lt;/P&gt;&lt;P&gt;And now I would like to get the first value the next month,&lt;/P&gt;&lt;P&gt;For example if January 2019 is selected I need to show the first value of February an so on..&lt;/P&gt;&lt;P&gt;If just 2019 its selected the table should show:&lt;/P&gt;&lt;P&gt;Jan&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;Feb&lt;/P&gt;&lt;P&gt;First value of February&amp;nbsp; &amp;nbsp; First Value of March and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Attached an Excel File with an Example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 16:12:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1663786#M594941</guid>
      <dc:creator>pgalvezt</dc:creator>
      <dc:date>2020-01-08T16:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1663859#M594942</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MC.PNG" style="width: 343px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26565iC267AADC77ECA0E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="MC.PNG" alt="MC.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD Date,
	 text(month(Date))as Month, 
     Value
FROM
[C:\Users\jfong2\Downloads\Example.xlsx]
(ooxml, embedded labels, table is Data);

MonthLoop:
load
distinct
Month
resident Data;

let vRow =NoOfRows('MonthLoop');
for i=1 to '$(vRow)'


let vMonth =peek('Month',$(i)-1,'MonthLoop');
Data2:
load Date(min(Date),'DD/MM/YYYY')as Date2,
	1 as Flag
	resident Data
	where Value&amp;gt;0
	and Month='$(vMonth)'
	group by
	Month;
next i

left join(Data2)
load Date as Date2,
	date(Date,'YYYYMM') as YearPeriod, 
     Value  resident Data;
     
drop table Data;
DROP TABLE MonthLoop;

NoConcatenate
Data3:
load TEXT(DATE(addmonths(YearPeriod,-1),'YYYYMM')) as YearPeriod,
	 Value as NextMonthValue,
	 Flag
resident Data2;
 
join(Data3)
load Date2,
	 Year(Date2)as Year,text(YearPeriod) as YearPeriod,
	 Value,
	 Flag resident Data2;
drop table Data2;

&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Jan 2020 03:31:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1663859#M594942</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2020-01-09T03:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670618#M594943</link>
      <description>&lt;P&gt;Hi, a couple questions...&lt;/P&gt;&lt;P&gt;Could You please explain the code ?&lt;/P&gt;&lt;P&gt;How can I read several years?&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 21:39:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670618#M594943</guid>
      <dc:creator>pgalvezt</dc:creator>
      <dc:date>2020-01-29T21:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670712#M594944</link>
      <description>&lt;P&gt;No issue reading multiple years from my side:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MC.PNG" style="width: 358px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/27693i47173C5C9C4A6026/image-size/large?v=v2&amp;amp;px=999" role="button" title="MC.PNG" alt="MC.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 06:16:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670712#M594944</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2020-01-30T06:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670905#M594945</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I entered more data for 2018 and 2020, interestingly the code is taking the data backwards and the data of 2019 is being lost, 2020 is not showing. maybe, I'm doing something wrong?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 13:32:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1670905#M594945</guid>
      <dc:creator>pgalvezt</dc:creator>
      <dc:date>2020-01-30T13:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1671102#M594946</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD Date,
	 text(Date(Date,'YYYYMM'))as Month, 
     Value
FROM
[C:\Users\jfong2\Downloads\Example.xlsx]
(ooxml, embedded labels, table is Data);

MonthLoop:
load
distinct
Month
resident Data;

let vRow =NoOfRows('MonthLoop');
for i=1 to '$(vRow)'


let vMonth =peek('Month',$(i),'MonthLoop');
Data2:
load Date(min(Date),'DD/MM/YYYY')as Date2,
	1 as Flag
	resident Data
	where Value&amp;gt;0
	and Month='$(vMonth)'
	group by
	Month;
next i

left join(Data2)
load Date as Date2,
	date(Date,'YYYYMM') as YearPeriod, 
     Value  resident Data;
     
drop table Data;
DROP TABLE MonthLoop;

NoConcatenate
Data3:
load TEXT(DATE(addmonths(YearPeriod,-1),'YYYYMM')) as YearPeriod,
	 Value as NextMonthValue,
	 Flag
resident Data2;
 
join(Data3)
load Date2,
	 Year(Date2)as Year,text(YearPeriod) as YearPeriod,
	 Value,
	 Flag resident Data2;
drop table Data2;

exit SCRIPT;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Jan 2020 00:55:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1671102#M594946</guid>
      <dc:creator>Arthur_Fong</dc:creator>
      <dc:date>2020-01-31T00:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get FirstValue of next Month script</title>
      <link>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1674113#M594947</link>
      <description>&lt;P&gt;Did Arthur's latest post get you what you needed?&amp;nbsp; If so, do not forget to return to the thread and use the Accept as Solution button on that post to give him credit for the assistance, and this also let's other Members know that did work.&amp;nbsp; If you are still trying to get things to work, leave an update, only way you are going to get additional posts at this point, as most folks will assume Arthur got things covered, so please be sure to either close things out or leave an update.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 20:14:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-FirstValue-of-next-Month-script/m-p/1674113#M594947</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-02-10T20:14:53Z</dc:date>
    </item>
  </channel>
</rss>

