<?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: Recalculation of utilization per line in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131364#M509840</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why this approach is not recommended ? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Sep 2018 10:14:04 GMT</pubDate>
    <dc:creator>kfir1987</dc:creator>
    <dc:date>2018-09-16T10:14:04Z</dc:date>
    <item>
      <title>Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131362#M509838</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 am trying&amp;nbsp; to calculate utilization per machine over the time (the time frame is daily), so I actually I want to see utilization for each machine over the days. &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;&lt;SPAN style="font-size: 10pt;"&gt;My raw data coming in the below structure:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="33.011364" style="width: 474.011px; height: 36.0114px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="left" height="19" width="85"&gt;Machine SN&lt;/TD&gt;&lt;TD align="left" width="72"&gt;End Time&lt;/TD&gt;&lt;TD align="left" width="72"&gt;Start Time&lt;/TD&gt;&lt;TD align="left" width="72"&gt;Actual time &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing issue when I try to calculate utilization (the utilization is not a column, I calculated it as Master Item)&amp;nbsp; , in some machines the start date and the end date is not in the same time ( it means the machine worked over 24 H) ! So as a result I can see that in some cases the utilization value is more than 100% ( it impossible). I`m trying to create a view that show each S\N and the machine utilization over the last 30 days. In cases that machine worked more than 1 day, I want to show the relative percentage on the first day and the last day and in between days to show 100%.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example: &lt;/P&gt;&lt;P&gt;the raw data is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="33.011364" style="width: 474.011px; height: 36.0114px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="left" height="19" width="85"&gt;Machine SN&lt;/TD&gt;&lt;TD align="left" width="72"&gt;End Time&lt;/TD&gt;&lt;TD align="left" width="72"&gt;Start Time&lt;/TD&gt;&lt;TD align="left" width="72"&gt;Actual time (min) &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="left" height="19" width="85"&gt;1111&lt;/TD&gt;&lt;TD align="left" width="72"&gt;25/02/2018&amp;nbsp; 12:38:36&lt;/TD&gt;&lt;TD align="left" width="72"&gt;23/02/2018&amp;nbsp; 22:43:49&lt;/TD&gt;&lt;TD align="left" width="72"&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 218px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="right" height="19" width="218"&gt;2266.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The machine worked for 1.5 days, so my expectation: &lt;/P&gt;&lt;P&gt;on the 23/02/18 - the machine worked for 1:16:11 H (24:00:00-22:43:49) so the utilization for this day is&amp;nbsp; 5% (1:16:11/24:00:00)&lt;/P&gt;&lt;P&gt;on the 24/02/18 - the machine worked for 24 H so the utilization should be 100%&lt;/P&gt;&lt;P&gt;on the 25/02/18 - the machine worked for 12:38:36 H&amp;nbsp; so the utilization for this day is&amp;nbsp; 53% (12:38:11/&lt;SPAN style="font-size: 10pt;"&gt;24:00:00)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to do it ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Sep 2018 08:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131362#M509838</guid>
      <dc:creator>kfir1987</dc:creator>
      <dc:date>2018-09-16T08:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131363#M509839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Possible? Yes. You can loop through any row where the start date and end date are not the same, and split those into multiple rows (two, usually, but could be more if it covers more than two days). You can get a general idea of the loop involved in this thread: &lt;A href="https://community.qlikview.com/thread/159004" title="https://community.qlikview.com/thread/159004"&gt;How to split a single row value into multiple r... | Qlik Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recommended? No. We deal with the same issue across multiple data sources and it was determined that the correct way to handle this is to have the data source split the lines to begin with. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Sep 2018 08:36:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131363#M509839</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2018-09-16T08:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131364#M509840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why this approach is not recommended ? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Sep 2018 10:14:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131364#M509840</guid>
      <dc:creator>kfir1987</dc:creator>
      <dc:date>2018-09-16T10:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131365#M509841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my experience, splitting lines with Qlik loops is terrible for performance. If you decide to go with that approach (and your information volume isn't trivial), make sure you set up an incremental reload so you don't have to handle large data volumes. Best bet is to set up a quick loop and see for yourself whether or not the performance is adequate for your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two other approaches you might be able to use here, if needed:&lt;/P&gt;&lt;P&gt;1) An arbitrary number of identical loads each handling a different multiple-day case (read the same data each time - the first time, for lines that start and end on the same day. The second, for lines that start and end on different days and take the start day. The third, different start/end date and take the second day. The fourth, take the third day, and so on). Your formula would check either vs the end date (if it matches the day you are currently reading) or midnight, as appropriate. I think this would offer better performance than looping for most cases. &lt;/P&gt;&lt;P&gt;2) Pre-streamline the information in your database using e.g. SSIS or using a cursor. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Sep 2018 11:42:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131365#M509841</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2018-09-16T11:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131366#M509842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you know how to do it on the editor ? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Sep 2018 11:57:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131366#M509842</guid>
      <dc:creator>kfir1987</dc:creator>
      <dc:date>2018-09-16T11:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131367#M509843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might depend on the way the loop is performed if you get a rather slow performance or not. Quite slow are approaches which use an outside-loop like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for each ... &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; load ...&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but an inside-loop like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load subfield(Field, Delimiter) as Field1 from Source;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or&lt;/P&gt;&lt;P&gt;load date(Date + iterno() - 1) as Date from Source while Date + iterno() - 1 &amp;lt;= EndDate;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is usually very fast even by millions of records whereby an incremental approach might be further helpful to minimize the run-times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 11:22:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131367#M509843</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-09-17T11:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Recalculation of utilization per line</title>
      <link>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131368#M509844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Absolutely correct, of course. In this case, though, I was not able to figure out a way to use inside loops and still get the desired outcome. That said, I last attempted this several years ago and even then it's highly possible that I missed a working solution at the time. Unfortunately, this means I can't help the OP with code - my solution was to address the source data (we now record machine work time once per hour, regardless of whether the machine is working or not, which means I just have to sum up the hours as desired; this also means we aren't limited to full-day calculations, which the loop solution here would likely be). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 12:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Recalculation-of-utilization-per-line/m-p/131368#M509844</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2018-09-17T12:12:43Z</dc:date>
    </item>
  </channel>
</rss>

