<?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: Generate Week Ending date for each month in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832133#M68660</link>
    <description>&lt;P&gt;Not sure but what if you run below native week end function for each date in your range?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="script_token"&gt;WeekEnd(&lt;/SPAN&gt;&lt;SPAN class="bnf_token"&gt;date [, period_no[, first_week_day]]&lt;/SPAN&gt;&lt;SPAN class="statement"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="statement"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 11:49:21 GMT</pubDate>
    <dc:creator>Digvijay_Singh</dc:creator>
    <dc:date>2021-08-30T11:49:21Z</dc:date>
    <item>
      <title>Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832121#M68658</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am using below script to generate week Ending date for each month, but the output is not as expected, meaning all the week ending are generated for all the month.&lt;/P&gt;&lt;P&gt;Unable to get what am doing wrong in the code below -&amp;nbsp;&lt;/P&gt;&lt;P&gt;vNoOfMonths = num(Month(today()))-1;&lt;/P&gt;&lt;P&gt;LET vMinDate = Date(Date#(MonthEnd(Today(),-$(vNoOfMonths)),'MM/DD/YYYY'),'YYYY-MM-DD') ;&lt;BR /&gt;LET vMaxDate = Date(Date#(MonthEnd(Today()),'MM/DD/YYYY'),'YYYY-MM-DD');&lt;BR /&gt;LET vMonth = ((year(Date(vMaxDate,'DD-MM-YYYY'))*12)+month(Date(vMaxDate,'DD-MM-YYYY'))) - ((year(Date(vMinDate,'DD-MM-YYYY'))*12)+month(Date(vMinDate,'DD-MM-YYYY')));&lt;/P&gt;&lt;P&gt;for a = 0 to vMonth&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;LET vDate = Date(Date#(MonthEnd(vMinDate,a),'MM/DD/YYYY'),'YYYY-MM-DD');&lt;BR /&gt;vWeek = num(MonthStart('$(vDate)'))&lt;BR /&gt;vDays = Ceil(MonthEnd('$(vDate)') - MonthStart('$(vDate)'));&lt;BR /&gt;&lt;BR /&gt;For i=1 to $(vDays)+7&lt;BR /&gt;&lt;BR /&gt;vWeekEnding = WeekEnd($(vWeek),0,0);&lt;BR /&gt;vWeek =vWeek+7;&lt;BR /&gt;&lt;BR /&gt;Concatenate (WeekEndingTemp)&lt;BR /&gt;Load * INline [&lt;BR /&gt;WeekEnding, Date&lt;BR /&gt;$(vWeekEnding), $(vDate)&lt;BR /&gt;];&lt;BR /&gt;next&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;The outer loop (with a as variable)&amp;nbsp; is to run the code under for for every month and for every month have to generate generate the week ending dates&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this will be really appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 10:56:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832121#M68658</guid>
      <dc:creator>punitpopli</dc:creator>
      <dc:date>2021-08-30T10:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832133#M68660</link>
      <description>&lt;P&gt;Not sure but what if you run below native week end function for each date in your range?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="script_token"&gt;WeekEnd(&lt;/SPAN&gt;&lt;SPAN class="bnf_token"&gt;date [, period_no[, first_week_day]]&lt;/SPAN&gt;&lt;SPAN class="statement"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="statement"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 11:49:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832133#M68660</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-08-30T11:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832142#M68661</link>
      <description>&lt;P&gt;am getting only the month end date and using above mentioned function will return only the last week end date and not all the Week End dates of the month&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 12:03:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832142#M68661</guid>
      <dc:creator>punitpopli</dc:creator>
      <dc:date>2021-08-30T12:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832144#M68662</link>
      <description>&lt;P&gt;May be I am missing something but this Weekend function's job is to return the last day of the week containing date. You have to feed it each day of the month though and then later use distinct to remove duplicates because all 7 days of a week will return the same weekend date.&lt;/P&gt;&lt;P&gt;This is what documentation says and I have used it as well -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This function returns a value corresponding to a timestamp of the last millisecond of the last day (Sunday) of the calendar week containing&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="statement"&gt;date&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/DateAndTimeFunctions/weekend.htm" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/DateAndTimeFunctions/weekend.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 12:09:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832144#M68662</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2021-08-30T12:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832153#M68663</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/42776"&gt;@punitpopli&lt;/a&gt;&amp;nbsp;, it should be a bit simpler. May be you get an idea from the given sample snippet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Load&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WeekEnd(Date) as WeekEnd,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Month(Date) as Month;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Load &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date(Today()-90+RecNo()) as Date&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;AutoGenerate 90;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tresesco_0-1630326370764.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60951i477BD09D0A2CE3C3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tresesco_0-1630326370764.png" alt="tresesco_0-1630326370764.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then you might want/have to put conditions for inclusion/exclusion of boundary values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 12:27:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832153#M68663</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2021-08-30T12:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832166#M68665</link>
      <description>&lt;P&gt;If I read the requirement correctly, this should be doable in a single, relatively simple loop once you've generated the dates to be tested (in my case I used an inline load):&lt;/P&gt;&lt;P&gt;Dates:&lt;BR /&gt;Load date(DayDate) as DayDate INLINE [&lt;BR /&gt;DayDate, Month&lt;BR /&gt;01/08/21, 8&lt;BR /&gt;02/08/21, 8&lt;BR /&gt;03/08/21, 8&lt;BR /&gt;04/08/21, 8&lt;BR /&gt;05/08/21, 8&lt;BR /&gt;06/08/21, 8&lt;BR /&gt;07/08/21, 8&lt;BR /&gt;08/08/21, 8&lt;BR /&gt;09/08/21, 8&lt;BR /&gt;10/08/21, 8&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For each vDayDate in FieldValueList('DayDate')&lt;/P&gt;&lt;P&gt;Weekends:&lt;BR /&gt;Load date('$(vDayDate)') as DayDate, WeekEnd('$(vDayDate)') as WeekendDate&lt;/P&gt;&lt;P&gt;Autogenerate(1);&lt;/P&gt;&lt;P&gt;Next;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the week end date may not be within the same month being tested, e.g. if Tuesday, August 31 is being tested for August, the WeekEnd() date will be in September.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 13:30:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832166#M68665</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2021-08-30T13:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832409#M68690</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22949"&gt;@tresB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply. This will help alternatively to what I was looking for&lt;/P&gt;&lt;P&gt;I was actually looking for trying to find the Week end date by adding a look on month end date which will not be ideal way to achieve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution will work for now. Thank you for all your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 08:17:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832409#M68690</guid>
      <dc:creator>punitpopli</dc:creator>
      <dc:date>2021-08-31T08:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Week Ending date for each month</title>
      <link>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832420#M68691</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6142"&gt;@Or&lt;/a&gt;&amp;nbsp; for your reply.&lt;/P&gt;&lt;P&gt;This will need me to maintain an inline load with some hardcoding and hence accepting what&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22949"&gt;@tresB&lt;/a&gt;&amp;nbsp; had suggested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once again, thank you for all your help and solution&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 08:30:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Generate-Week-Ending-date-for-each-month/m-p/1832420#M68691</guid>
      <dc:creator>punitpopli</dc:creator>
      <dc:date>2021-08-31T08:30:10Z</dc:date>
    </item>
  </channel>
</rss>

