<?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: Splitting the data - On the way to granularity in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468146#M699339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys you're the best. Thanks a lot!!! In the meantime I'll try to understand the code &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//chesterluck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Nov 2012 12:51:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-11-28T12:51:38Z</dc:date>
    <item>
      <title>Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468139#M699332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a really tricky problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One Table has State-Information (Field lState)&lt;/P&gt;&lt;P&gt;This state has a start time and a end time. &lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;lState&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tStart&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tEnd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Duration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223454&lt;/TD&gt;&lt;TD&gt;20121126 11:04:33&lt;/TD&gt;&lt;TD&gt;20121126 11:10:40&lt;/TD&gt;&lt;TD&gt;6 min&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223455&lt;/TD&gt;&lt;TD&gt;20121126 06:00:00&lt;/TD&gt;&lt;TD&gt;20121127 13:00:00&lt;/TD&gt;&lt;TD&gt;1 d 7 h&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to achive a more detailed granularity:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have three time zones per day:&lt;/P&gt;&lt;P&gt;TZ1: 06:00:00 - 14:00:00&lt;/P&gt;&lt;P&gt;TZ2: 14:00:00 - 22:00:00&lt;/P&gt;&lt;P&gt;TZ3: 22:00:00 - 06:00:00 (on the next day)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The split should lead to the following output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;lState&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tStart&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tEnd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Duration&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Day&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;TimeZone&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1223454&lt;/TD&gt;&lt;TD&gt;20121126 11:04:33&lt;/TD&gt;&lt;TD&gt;20121126 11:10:40&lt;/TD&gt;&lt;TD&gt;6 min&lt;/TD&gt;&lt;TD&gt;20121126&lt;/TD&gt;&lt;TD&gt;TZ1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1223455&lt;/TD&gt;&lt;TD&gt;20121126 06:00:00&lt;/TD&gt;&lt;TD&gt;20121126 14:00:00&lt;/TD&gt;&lt;TD&gt;8 h&lt;/TD&gt;&lt;TD&gt;20121126&lt;/TD&gt;&lt;TD&gt;TZ1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1223455&lt;/TD&gt;&lt;TD&gt;20121126 14:00:00&lt;/TD&gt;&lt;TD&gt;20121126 22:00:00&lt;/TD&gt;&lt;TD&gt;8 h&lt;/TD&gt;&lt;TD&gt;20121126&lt;/TD&gt;&lt;TD&gt;TZ2&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1223455&lt;/TD&gt;&lt;TD&gt;20121126 22:00:00&lt;/TD&gt;&lt;TD&gt;20121127 06:00:00&lt;/TD&gt;&lt;TD&gt;8 h&lt;/TD&gt;&lt;TD&gt;20121126&lt;/TD&gt;&lt;TD&gt;TZ3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;1223455&lt;/TD&gt;&lt;TD&gt;20121127 06:00:00&lt;/TD&gt;&lt;TD&gt;20121127 13:00:00&lt;/TD&gt;&lt;TD&gt;7 h&lt;/TD&gt;&lt;TD&gt;20121127&lt;/TD&gt;&lt;TD&gt;TZ1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For sure I'll need some for next loops , but as I'm quite new to QlikView this is a too big fish for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe somebody is interested in solving this nice problem or has already solved a similar problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is welcome&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//chesterluck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 17:07:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468139#M699332</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-26T17:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468140#M699333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached qvw. Somebody can probably do this more efficiently, but this kludge seems to work at least.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 19:30:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468140#M699333</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-26T19:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468141#M699334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Hey it looks already not bad, but still there is is a logical error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;I loaded new record to test the split:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;lState,tStart,tEnd,Duration&lt;/P&gt;&lt;P&gt;1223456,20121128 02:00:33, 20121130 01:02:02, 1 d 4 h&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the output:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="25628" class="jive-image-thumbnail jive-image" height="220" onclick="" alt="ScreenSplit.jpg" src="https://community.qlik.com/legacyfs/online/25628_ScreenSplit.jpg" width="519" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The target-output should look like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN id="mce_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN id="mce_marker"&gt;Original dataset: 1223456, 20121128 02:00:33, 20121130 01:02:02&lt;/SPAN&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;A&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;&lt;SPAN&gt;﻿&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;New_Id&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;lState&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tBegin&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;tEnd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Duration (Calculated)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;TimeZone&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_1&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121128 02:00:33&lt;/TD&gt;&lt;TD&gt;20121128 05:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ3&lt;/TD&gt;&lt;TD style="BACKGROUND-COLOR: #eb6513;" valign="top"&gt;20121128&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_2&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121128 06:00:00&lt;/TD&gt;&lt;TD&gt;20121128 13:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ1&lt;/TD&gt;&lt;TD&gt;20121128&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_3&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121128 14:00:00&lt;/TD&gt;&lt;TD&gt;20121128 21:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ2&lt;/TD&gt;&lt;TD&gt;20121128&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_4&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121128 22:00:00&lt;/TD&gt;&lt;TD&gt;20121129 05:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ3&lt;/TD&gt;&lt;TD style="BACKGROUND-COLOR: #ed5c11;" valign="top"&gt;20121129&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_5&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121129 06:00:00&lt;/TD&gt;&lt;TD&gt;20121129 13:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ1&lt;/TD&gt;&lt;TD&gt;20121129&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_6&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121129 14:00:00&lt;/TD&gt;&lt;TD&gt;20121129 21:59:59&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ3&lt;/TD&gt;&lt;TD&gt;20121129&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1223456_7&lt;/TD&gt;&lt;TD&gt;1223456&lt;/TD&gt;&lt;TD&gt;20121129 22:00:00&lt;/TD&gt;&lt;TD&gt;&lt;SPAN id="mce_marker"&gt;20121130 01:02:02&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;tEnd-tBegin&lt;/TD&gt;&lt;TD&gt;TZ3&lt;/TD&gt;&lt;TD style="BACKGROUND-COLOR: #ed5c11;" valign="top"&gt;&lt;SPAN id="mce_marker"&gt;20121130&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿I ll try to change the code, but it would be great if you also would have a look&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;//chesterluck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 11:36:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468141#M699334</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-27T11:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468142#M699335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I elaborated a bit and wrote soe code, maybe it is helpful to answer the question. As I said, Im quite new to QlikView &lt;/P&gt;&lt;P&gt;and please you to exuse my mistakes. Here the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ps Thanks a lot&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Inline_Load:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;load &lt;BR /&gt;lState,&lt;BR /&gt;Timestamp#(tStart,'YYYYMMDD hh:mm:ss') as tStart,&lt;BR /&gt;Timestamp#(tEnd,'YYYYMMDD hh:mm:ss') as tEnd,&lt;BR /&gt;hour(Timestamp#(tStart,'YYYYMMDD hh:mm:ss')) as hStart,&lt;BR /&gt;hour(Timestamp#(tEnd,'YYYYMMDD hh:mm:ss')) as hEnd,&amp;nbsp; &lt;BR /&gt;tEnd - tStart as Duration&lt;/P&gt;&lt;P&gt;Inline [&lt;BR /&gt;lState,tStart,tEnd&lt;BR /&gt;1223454,20121126 11:04:33, 20121128 13:10:40&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Variables&lt;BR /&gt;Set tSplitEnd = 'YYYYMMDD hh:mm:ss';&lt;BR /&gt;Set tSplitStart = 'YYYYMMDD hh:mm:ss';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If ((hStart &amp;gt;= 22 and hEnd &amp;lt; 6 and Duration &amp;lt;= &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; OR (hStart &amp;gt;= 6 and hEnd &amp;lt; 14 and Duration &amp;lt;= &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; OR (hStart &amp;gt;= 14 and hEnd &amp;lt; 22 and Duration &amp;lt;= 8)) Then &lt;BR /&gt;//MsgBox("Do Nothing")&lt;BR /&gt;ELSE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let tSplitStart = tStart;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt; If hStart &amp;gt; 22 Then &lt;BR /&gt; Let tSplitEnd = Timestamp#(Date#(tBegin, 'YYYYMMDD') + 1 + MakeTime(5,59,59), 'YYYYMMDD hh:mm:ss');&lt;BR /&gt; &lt;BR /&gt; ELSEIF hStart &amp;lt; 6 Then&lt;BR /&gt; Let tSplitEnd = Timestamp#(Date#(tBegin, 'YYYYMMDD') + MakeTime(5,59,59), 'YYYYMMDD hh:mm:ss');&lt;BR /&gt; &lt;BR /&gt; ELSEIF hStart &amp;lt; 14 Then&lt;BR /&gt; Let tSplitEnd = Timestamp#(Date#(tBegin, 'YYYYMMDD') + MakeTime(13,59,59), 'YYYYMMDD hh:mm:ss');&lt;BR /&gt; &lt;BR /&gt; ELSE&lt;BR /&gt; Let tSplitEnd = Timestamp#(Date#(tBegin, 'YYYYMMDD') + MakeTime(21,59,59), 'YYYYMMDD hh:mm:ss');&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;EM style="color: #808080; font-size: 8pt;"&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; End If&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; For i = 1 to Duration/8 + 2 //2 as appx add. quant&lt;BR /&gt;&amp;nbsp; If tSplitBegin &amp;lt; tEnd Then&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; tStart = tSplitStart;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; If tSplitEnd &amp;lt;= tEnd Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Let tEnd = tSplitEnd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Else &lt;BR /&gt;&amp;nbsp;&amp;nbsp; Let tEnd = tEnd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; tSplitBegin = Timestamp#(Date#(tSplitBegin, 'YYYYMMDD') + MakeTime(8,0,0), 'YYYYMMDD hh:mm:ss');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tSplitEnd = Timestamp#(Date#(tSplitEnd, 'YYYYMMDD') + MakeTime(8,0,0), 'YYYYMMDD hh:mm:ss');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR /&gt; //Should be used somewhere in the code &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;BR /&gt;//concatenate (Inline_Load) load&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 14:38:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468142#M699335</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-27T14:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468143#M699336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so you want Day to be the day part of tEnd and not of tStart. That can't be determined from your first example. But it's easy enough to do. Copy the calculation for tEnd, change the date format to 'YYYYMMDD' (leaving out th hh:mm:ss) and name it as Day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 10:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468143#M699336</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-11-28T10:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468144#M699337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="25703" class="jive-image-thumbnail jive-image" height="218" onclick="" alt="ScreenSplit.jpg" src="https://community.qlik.com/legacyfs/online/25703_ScreenSplit.jpg" width="502" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im a bit unsure whether you understood me right.&lt;/P&gt;&lt;P&gt;I also figured it out with the end date , so thats fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in your solution, as you can see (red color), its counting 8 hrs to the start timestamp. &lt;/P&gt;&lt;P&gt;As you can see below, there is &lt;SPAN style="text-decoration: underline;"&gt;exactly&lt;/SPAN&gt; one data set with the original tBegin and &lt;SPAN style="text-decoration: underline;"&gt;exactly&lt;/SPAN&gt; one with the original tEnd (Red color). Depending on the TimeZone (defined in the original question) all the added tBegin can have three possible characteristics (06:00:00;14:00:00;22:00:00); all the added tEnd (05:59:59;13:59:59;21:59:59) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="25705" class="jive-image-thumbnail jive-image" height="389" onclick="" alt="Unbenannt.jpg" src="https://community.qlik.com/legacyfs/online/25705_Unbenannt.jpg" width="507" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 10:56:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468144#M699337</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-28T10:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468145#M699338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;INPUT:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;lState,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Timestamp#(tStart,'YYYYMMDD hh:mm:ss') as tStart,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Timestamp#(tEnd,'YYYYMMDD hh:mm:ss') as tEnd&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Inline [&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;lState,tStart,tEnd,Duration&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1223454,20121126 11:04:33,&amp;nbsp;&amp;nbsp;&amp;nbsp; 20121126 11:10:40,6 min&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1223455,20121126 06:00:00, 20121127 13:00:00,1 d 7 h&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1223456,20121128 02:00:33, 20121130 01:02:02, 1 d 4 h&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1223457,20121128 19:00:33, 20121130 01:02:02, 1 d 4 h&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;RESULT:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, interval(End-Start) as Duration;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, if(tStart &amp;gt; TZStart, tStart, TZStart) as Start, if(tEnd &amp;lt; TZEnd, tEnd, TZEnd) as End ; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD iterno() as ShiftID, lState, tStart, tEnd, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;timestamp(floor(tStart,1/3,1/4)+(iterno()-1)*1/3) as TZStart,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;timestamp(floor(tStart,1/3,1/4)+iterno()*1/3-interval#(1,'fff') ) as TZEnd, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;mod(round((floor(tStart,1/3,1/4)+(iterno()-1)*1/3)*12),3)+1 as TZ&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident INPUT&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;while floor(tStart,1/3,1/4) + (iterno()-1)/3 &amp;lt;= floor(tEnd,1/3,1/4);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table INPUT;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 11:07:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468145#M699338</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-11-28T11:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468146#M699339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys you're the best. Thanks a lot!!! In the meantime I'll try to understand the code &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//chesterluck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Nov 2012 12:51:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468146#M699339</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-28T12:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468147#M699340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi swuehl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the splitt works fine ..almost: I figured out one example where it doesnt work :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no clue where the mistake in the code is.. Normally it should produce 2 raws - 2nd raw ShiftID 2 from 14:00:00 until 21:55:18...Thank you in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error.png" class="jive-image-thumbnail jive-image" height="96" onclick="" src="https://community.qlik.com/legacyfs/online/26979_error.png" width="693" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 11:12:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468147#M699340</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-18T11:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468148#M699341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't open the attached image. Could you post the problematic input data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD * Inline [&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;lState,tStart,tEnd&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 11:33:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468148#M699341</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-12-18T11:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468149#M699342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="WIDTH: 867px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="68"&gt;lMacStaRef&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="57"&gt;ShiftID&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="110"&gt;Start&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="109"&gt;End&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="53"&gt;Duration&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="110"&gt;tBegin&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="110"&gt;tEnd&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="18"&gt;TZ&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="109"&gt;TZStart&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none;" width="123"&gt;TZEnd&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: medium none;"&gt;15687141&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: medium none; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 11:00:00&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 14:00:00&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-left: medium none; border-top: medium none;"&gt;3:00:00&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 11:00:00&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 21:55:18&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-left: medium none; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 06:00:00&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: medium none; border-top: medium none;"&gt;02.06.2012 14:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End and TZEnd sould be 13:59:59&lt;/P&gt;&lt;P&gt;The second shift is missing and should be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15687141 - 2 -&amp;nbsp; 02.06.2012 14:00:00&amp;nbsp;&amp;nbsp; -&amp;nbsp; 02.06.2012 21:55:18 - 9:55:18 - 02.06.2012 11:00:00 - 02.06.2012 21:55:18 - 2 - 02.06.2012 14:00:00 - 02.06.2012 21:59:59&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 12:06:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468149#M699342</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-18T12:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468150#M699343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, it's never a good idea to compare two floating point values &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make my approach stable, we need to add a small amount of time (say 1 ms) to the one end of the WHILE comparison:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;while floor(tStart,1/3,1/4) + (iterno()-1)/3 &amp;lt; floor(tEnd,1/3,1/4)&lt;STRONG&gt;+interval#(1,'fff')&lt;/STRONG&gt;;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 12:56:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468150#M699343</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-12-18T12:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468151#M699344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the problem is that at the end of a while loop the comp might still calc and the while already goes further?? was that the problem??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I let you know whether its running smooth now &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx a lot already&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 13:21:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468151#M699344</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-18T13:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468152#M699345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, it works fine..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a last question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where should I split a quantity field (Number of parts) - during the split or can i do it after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I started to do it and im basically just counting the persentage of a Timezonepart to the complete StateTime and then i multiply it with the Quantity nr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;round((DurationStatePart/DurationState)*ShotsAll) as NumberOfShotsInTheStatePart&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sth like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem iswhen the numbers are like this:&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;20,5&lt;/P&gt;&lt;P&gt;19,5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While rounding I would get one part more....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 14:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468152#M699345</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-18T14:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468153#M699346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&amp;gt;So the problem is that at the end of a while loop the comp might still calc and the while already goes further?? was that the problem??&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hm, no, I don't think so. The problem is that floating point calculations might be a bit off due to the internal representation even when the calculation is logically / mathematically correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;floor(tStart,1/3,1/4) + 1/3 &amp;lt;= floor(tEnd,1/3,1/4) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;might return false even (with your numbers for tStart and tEnd entered), even when it should return true, because floating point arithmetic calculations were not 100% correct, just a little off (for example, 1/3 cannot be represented correctly in the used base system).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[edit]: Even this should be more stable than my first version, though in a mathmetical sense, both should be equal:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;while floor(tStart+ (iterno()-1)/3 ,1/3,1/4)&amp;nbsp; &amp;lt;= floor(tEnd,1/3,1/4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt;While rounding I would get one part more.... any idea?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So your requirement is that the sum of your rounded numbers equals ShotsAll, right? So you need an unbiased tie-breaking when rounding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think there is the one and only one correct answer to this, maybe you can try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEST:&lt;/P&gt;&lt;P&gt;LOAD recno() as ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TEST, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; floor(TEST) as FLOOR, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TEST - floor(TEST) as DIFF &lt;/P&gt;&lt;P&gt;INLINE [&lt;/P&gt;&lt;P&gt;TEST&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;20.5&lt;/P&gt;&lt;P&gt;19.5&lt;/P&gt;&lt;P&gt;18.5&lt;/P&gt;&lt;P&gt;21.5&lt;/P&gt;&lt;P&gt;18.6&lt;/P&gt;&lt;P&gt;19.4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOIN LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; round(sum(TEST)-SUM(FLOOR)) as TOSHARE &lt;/P&gt;&lt;P&gt;Resident TEST;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD ID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RANGESUM(FLOOR, if(recno()&amp;lt;=TOSHARE,1,0)) as RESULT&amp;nbsp; &lt;/P&gt;&lt;P&gt;Resident TEST order by DIFF desc, FLOOR desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 16:32:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468153#M699346</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-12-18T16:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the data - On the way to granularity</title>
      <link>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468154#M699347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well I tried your solution with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;while&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;tBegin&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,1/3,1/4) + (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;iterno&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;()-1)/3 &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;floor&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;tEnd&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,1/3,1/4)&lt;BR /&gt;+ &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;interval#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;(1,'fff'); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;and it seems to be stable (I builded Sum over 50000 rows)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I understand it right that this solution : &lt;/P&gt;&lt;P&gt;while floor(tStart+ (iterno()-1)/3 ,1/3,1/4)&amp;nbsp; &amp;lt;= floor(tEnd,1/3,1/4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;might be even more stable??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chesterluck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 13:28:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Splitting-the-data-On-the-way-to-granularity/m-p/468154#M699347</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-19T13:28:32Z</dc:date>
    </item>
  </channel>
</rss>

