<?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: max month by year in scripting side for looping in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323820#M9626</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;The answer Liron gave you will do the trick.&lt;/P&gt;&lt;P&gt;But just to elaborate on why your script didn't work:&lt;/P&gt;&lt;P&gt;You populate the variables with only the first row - min/max of first year.&lt;/P&gt;&lt;P&gt;You didn't include a 'next i' code to continue the loop.&lt;/P&gt;&lt;P&gt;That's why you end up with only two rows of value of the first month for both the years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Eliran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 02 Apr 2017 20:07:36 GMT</pubDate>
    <dc:creator>eliran</dc:creator>
    <dc:date>2017-04-02T20:07:36Z</dc:date>
    <item>
      <title>max month by year in scripting side for looping</title>
      <link>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323818#M9624</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;I am facing a problem where I need to run a loop between minimum and maximum month w.r.t different years but whenever I am trying to run below code, it takes maximum month w.r.t to maximum Year. My use case it should take maximum month in variable w.r.t Year respectively.I am writing the code where I am trying to cumulative sum on months. In front end it is possible as max(&amp;lt;{Year={$(=max(Year))}}&amp;gt;month) but I want to do this on scripting side. I am attaching the data file also. &lt;STRONG style="font-size: 13.3333px;"&gt;vMaxMnth&lt;/STRONG&gt; this should change w.r.t Years&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD FMonth, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value&lt;/P&gt;&lt;P&gt;FROM [xxxxx\Book11.xlsx] (ooxml, embedded labels, table is Sheet1)&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;MIN_MAX:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; min(FMonth) as MinMnth,&lt;/P&gt;&lt;P&gt;&amp;nbsp; max(FMonth) as MaxMnth,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Year&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESIDENT Data&lt;/P&gt;&lt;P&gt;group by Year;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vMinMnth = peek('MinMnth',0,'MIN_MAX');&lt;/P&gt;&lt;P&gt;let vMaxMnth = peek('MaxMnth',0,'MIN_MAX');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;FOR i = $(vMinMnth) to &lt;STRONG&gt;$(vMaxMnth)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SALES1:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; $(i) as FMonth,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sum(Value) as Value1,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Year&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident Data&lt;/P&gt;&lt;P&gt;&amp;nbsp; Where FMonth &amp;lt;= $(i) &lt;/P&gt;&lt;P&gt;&amp;nbsp; group by Year;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Apr 2017 19:09:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323818#M9624</guid>
      <dc:creator>rohitk1609</dc:creator>
      <dc:date>2017-04-02T19:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: max month by year in scripting side for looping</title>
      <link>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323819#M9625</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 i understand correctly &lt;/P&gt;&lt;P&gt;this script will calculate the accumulative sum for each year &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataTemp:&lt;/P&gt;&lt;P&gt;LOAD [FMonth],&lt;/P&gt;&lt;P&gt;&amp;nbsp; [Year],&lt;/P&gt;&lt;P&gt;&amp;nbsp; [Value]&lt;/P&gt;&lt;P&gt; FROM [lib://Downloads/Book11.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if([Year]=previous([Year]),RangeSum(peek('ValueYTD'),[Value]) ,[Value]) as ValueYTD&lt;/P&gt;&lt;P&gt;Resident DataTemp&lt;/P&gt;&lt;P&gt;Order By [Year],[FMonth];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop Table DataTemp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Apr 2017 19:55:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323819#M9625</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2017-04-02T19:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: max month by year in scripting side for looping</title>
      <link>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323820#M9626</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;The answer Liron gave you will do the trick.&lt;/P&gt;&lt;P&gt;But just to elaborate on why your script didn't work:&lt;/P&gt;&lt;P&gt;You populate the variables with only the first row - min/max of first year.&lt;/P&gt;&lt;P&gt;You didn't include a 'next i' code to continue the loop.&lt;/P&gt;&lt;P&gt;That's why you end up with only two rows of value of the first month for both the years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps,&lt;/P&gt;&lt;P&gt;Eliran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Apr 2017 20:07:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/max-month-by-year-in-scripting-side-for-looping/m-p/1323820#M9626</guid>
      <dc:creator>eliran</dc:creator>
      <dc:date>2017-04-02T20:07:36Z</dc:date>
    </item>
  </channel>
</rss>

