<?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: Dates, columns to rows, Scripting help needed in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186518#M627547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please find attached the kind of calendar I'd use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first field should be similar to your table, so that the join will be made. You may need to script like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month&amp;amp;year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week&lt;/P&gt;&lt;P&gt;FROM.....&lt;/P&gt;&lt;P&gt;WHERE len(week) = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way, you will not load the weekends.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Sep 2016 13:56:26 GMT</pubDate>
    <dc:creator>puttemans</dc:creator>
    <dc:date>2016-09-16T13:56:26Z</dc:date>
    <item>
      <title>Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186515#M627544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a complex requirement, any suggestion is much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have:&lt;/P&gt;&lt;P&gt;A file with Monthly values, e.g: For a Line of Business A, June Amount is xxx $&lt;/P&gt;&lt;P&gt;I have a Qlikview dashboard with Facts and Dimensions and this file has to be handled directly by Qlikview but rest of the tables come from a database&lt;/P&gt;&lt;P&gt;A single LOB can have multiple Entities&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need:&lt;/P&gt;&lt;P&gt;I will have to split the Monthly amount into Weeks and then into days omitting the weekends&lt;/P&gt;&lt;P&gt;I will have to introduce the dates according to the month mentioned in the file e.g. for June 2016, i will have to introduce dates for weekdays.&lt;/P&gt;&lt;P&gt;I will have to introduce rows for each date and for each LOB and each Entity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to the attached excel and let me know if more information is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ga&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2016 11:50:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186515#M627544</guid>
      <dc:creator />
      <dc:date>2016-09-16T11:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186516#M627545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would first add the dates. If you create a separate calendar for 2016, with only the weekdays, then based upon the Year variable and the Month variable, you could create a unique link (e.g. june-16) that also shows in your calendar. With a left join, you'd only add the necessary lines per month for each separate line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the week-function, you would then get a view on the weeks per month. You'll get e.g.36 instead of 1 to x for every month. In your example, you start with a full week, but what do you want to happen when you only have e.g. 2 days in the first week. Through ranking and mapping, you could identify the lowest week number per month, or you could pre-code it into your calendar as well, and have it loaded in the previous step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the last step is to calculate the monthly amount into daily. That can be done with the if statement. As you have all the info in one line. If (week = 1, amount*0.1/5, if (week = 2, amount*0.15/5, if(week = 3, amount*0.25/5, if(week = 4, amount*0.5/5, '0')))) This should give you per line a separate date, a week, a month an a correct amount. And from there you can go on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;johan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2016 13:16:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186516#M627545</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2016-09-16T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186517#M627546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply Johan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a calendar in my data model , can it be used to include a date column?&lt;/P&gt;&lt;P&gt;And a small clarification on the amount calculation, it should be like, for week1 it is always 10% of the Total Amount divided by the number of days in that week. so if there are 2 days in that week, the amount should be divided by 2.&lt;/P&gt;&lt;P&gt;My calendar table, has a weekday flag, could it be used here? if so, please guide me to implement it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All i need is a new column with dates so that i could connect to the calendar table in my data model and the calculated amount in rows from the single month amount column.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2016 13:42:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186517#M627546</guid>
      <dc:creator />
      <dc:date>2016-09-16T13:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186518#M627547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please find attached the kind of calendar I'd use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first field should be similar to your table, so that the join will be made. You may need to script like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month&amp;amp;year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week&lt;/P&gt;&lt;P&gt;FROM.....&lt;/P&gt;&lt;P&gt;WHERE len(week) = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way, you will not load the weekends.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2016 13:56:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186518#M627547</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2016-09-16T13:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186519#M627548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for the number of days, then I think the easiest would be to already add the info. You can script it, but the effort may not weigh up against adding it to the calendar file, and thus importing the info directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example should then be somewhat changed to the attched&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2016 14:00:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186519#M627548</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2016-09-16T14:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186520#M627549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Johan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me with a sample application?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 14:13:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186520#M627549</guid>
      <dc:creator />
      <dc:date>2016-09-20T14:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186521#M627550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Try below script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14743846222285158" jivemacro_uid="_14743846222285158"&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;load* ,&lt;/P&gt;
&lt;P&gt;MakeDate(Year(Date#(right(Year,2),'YY')),month(date#(Left(Month,3),'MMM')) ) as Date;&lt;/P&gt;
&lt;P&gt;LOAD * Inline [&lt;/P&gt;
&lt;P&gt;Code,Desc, Line of Business, Year, Month, Amount&lt;/P&gt;
&lt;P&gt;1 ,A1 ,LOB1, FY16, June, 8845867.549&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LET vVal=num(Peek('Date',0,'Table'));&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;For i=day(MonthStart('$(vVal)')) to day(MonthEnd('$(vVal)'))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET VNew=date($(vVal)+($(i)-1));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PreFinal:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load *, date('$(VNew)') as New_Date,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF( Ceil(day('$(VNew)')/7)=1,(Amount*0.10)/5,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Ceil(day('$(VNew)')/7)=2, (Amount*0.15)/5,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Ceil(day('$(VNew)')/7)=3, (Amount*0.25)/5,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Ceil(day('$(VNew)')/7)=4, (Amount*0.50)/5)))) as disAmount,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'W'&amp;amp; Ceil(day('$(VNew)')/7) as Week Resident Table where WeekDay('$(VNew)')&amp;lt;5 ;&lt;/P&gt;
&lt;P&gt;NEXT i;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Drop Tables Table;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2016 15:17:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186521#M627550</guid>
      <dc:creator>sasikanth</dc:creator>
      <dc:date>2016-09-20T15:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186522#M627551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ganesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached a sample. I've taken your input, and created the calendar for June.Just let me know if you need an extra.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Johan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 07:20:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186522#M627551</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2016-09-21T07:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186523#M627552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help Sasi. I will look into this and reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 14:21:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186523#M627552</guid>
      <dc:creator />
      <dc:date>2016-09-21T14:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186524#M627553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your time and efforts Johan. There is a small change to the input file and i have attached it here. Also the calendar which i already have is attached as well. Can you please give me your suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2016 15:47:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186524#M627553</guid>
      <dc:creator />
      <dc:date>2016-09-21T15:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186525#M627554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ga,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the example based on your newest documents. It needed a tweak because of the crosstable you want to load.&lt;/P&gt;&lt;P&gt;I've also added one column extra in the input-file for the number of days (NRDAYOFWEEK). If you're not able to add this line in your basic input, you may need to calculate it first within the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Johan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 08:18:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186525#M627554</guid>
      <dc:creator>puttemans</dc:creator>
      <dc:date>2016-09-23T08:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186526#M627555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for the help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 14:13:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186526#M627555</guid>
      <dc:creator />
      <dc:date>2016-09-23T14:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dates, columns to rows, Scripting help needed</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186527#M627556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me try to calculate the Number of days in a week at Script level. I will reach out to you, if i fail at it.Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 14:13:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-columns-to-rows-Scripting-help-needed/m-p/1186527#M627556</guid>
      <dc:creator />
      <dc:date>2016-09-23T14:13:56Z</dc:date>
    </item>
  </channel>
</rss>

