<?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 How to split monthly data into weekly in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673588#M728642</link>
    <description>&lt;P&gt;Hello, could someone please help me to write a script how to split monthly data for different SKU and Customers into weekly data. If the week number is covering two months, I need to assign&amp;nbsp; week to the month which has more days. I have never worked with master calendar before and i am lack of knowledge how to start it :(.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Giedrius&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 19:09:10 GMT</pubDate>
    <dc:creator>torpe999</dc:creator>
    <dc:date>2024-11-16T19:09:10Z</dc:date>
    <item>
      <title>How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673588#M728642</link>
      <description>&lt;P&gt;Hello, could someone please help me to write a script how to split monthly data for different SKU and Customers into weekly data. If the week number is covering two months, I need to assign&amp;nbsp; week to the month which has more days. I have never worked with master calendar before and i am lack of knowledge how to start it :(.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Giedrius&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:09:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673588#M728642</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2024-11-16T19:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673608#M728643</link>
      <description>&lt;P&gt;can you share the expected&amp;nbsp; output from this sample data?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Feb 2020 13:49:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673608#M728643</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-02-09T13:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673624#M728644</link>
      <description>&lt;P&gt;hi, i would like to get them in attached format. I have actual&amp;nbsp; sales data in years and weeks but planned volume in years and&amp;nbsp; months. I need to compare weekly data&amp;nbsp; so I need to convert planned monthly volumes into weekly and compare data by week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Giedrius&lt;/P&gt;</description>
      <pubDate>Sun, 09 Feb 2020 18:03:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673624#M728644</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2020-02-09T18:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673693#M728645</link>
      <description>&lt;P&gt;I'm sorry, but unless you have a date field you can place into a specific week, i.e. 1/17/2019, you cannot. In your data you only have month number.&lt;/P&gt;&lt;P&gt;HTH, John&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 00:42:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673693#M728645</guid>
      <dc:creator>johnca</dc:creator>
      <dc:date>2020-02-10T00:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673758#M728646</link>
      <description>&lt;P&gt;just one more thing- maybe it's possible to split monthly volumes into days proportionally first and then define the weeks?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Giedrius&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 08:31:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673758#M728646</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2020-02-10T08:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673763#M728647</link>
      <description>&lt;P&gt;I can propose a solution, I need you to confirm something:&lt;BR /&gt;For February 1, 2020, the week number is 5, so for February you'll be BU Litre/5 instead of 4.&lt;/P&gt;&lt;P&gt;if you can give me a quick feedback it will be excellent.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 08:57:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673763#M728647</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-02-10T08:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673765#M728648</link>
      <description>&lt;P&gt;That's fine :), thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 09:04:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673765#M728648</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2020-02-10T09:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673766#M728649</link>
      <description>&lt;P&gt;so /5 for 02/2020 ?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 09:05:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673766#M728649</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-02-10T09:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673770#M728650</link>
      <description>&lt;P&gt;yes, ok!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 09:08:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673770#M728650</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2020-02-10T09:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673781#M728651</link>
      <description>&lt;P&gt;the script is a bit long, I did it quickly but you can optimize it if you want.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:
LOAD 
     year, 
     month,
     weekstart(Makedate(year,month,1)) as DATESTART,
     Monthend(Makedate(year,month,1)) as DATEEND, 
     customer, 
     [SKU nr], 
     [BU liters]
FROM
.\litrai.xlsx
(ooxml, embedded labels, table is litrai);


temp:

load min(DATESTART) as min, max(DATEEND) as max resident Data;

Let varMinDate = Peek('min', 0, 'temp');
Let varMaxDate = Peek('max', 0, 'temp'); 


TempCalendar:
noconcatenate
LOAD

    Date($(varMinDate) + IterNo() - 1) as DATETMP

    AutoGenerate 1 While $(varMinDate) + IterNo() -1 &amp;lt;= $(varMaxDate); 

left join
load * resident Data;

drop table temp, Data;


output:
noconcatenate

load year, 
     month,
     if(DATETMP&amp;gt;=DATESTART and DATETMP&amp;lt;=DATEEND,week(DATETMP)) as WEEK,
     DATESTART,
     DATEEND,
     customer, 
     [SKU nr], 
     [BU liters]
     resident TempCalendar;

drop table TempCalendar;


output1:
noconcatenate

load   
       year, 
       month,
       WEEK,
     customer, 
     [SKU nr], 
     [BU liters]
     resident output where not isnull(WEEK);

drop table output;


Final1 :
noconcatenate

load count(distinct WEEK) as w resident output1 group by year,month,customer,[SKU nr];

left join

load * resident output1;

drop table output1;


result:

load  
      year, 
      WEEK,
     month,
     customer, 
     [SKU nr], 
     [BU liters],
     [BU liters]/w as [NEW BU liters] 

resident Final1;
     
drop table Final1;&lt;/LI-CODE&gt;&lt;P&gt;and output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 484px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/28178iD551E63DB6E2463E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;attached Qlikview file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 09:24:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673781#M728651</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-02-10T09:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to split monthly data into weekly</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673950#M728652</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;Taoufiq ZARRA, you helped a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;BR/Giedrius&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:05:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-split-monthly-data-into-weekly/m-p/1673950#M728652</guid>
      <dc:creator>torpe999</dc:creator>
      <dc:date>2020-02-10T15:05:37Z</dc:date>
    </item>
  </channel>
</rss>

