<?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 average hours between a start and end date? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900580#M12505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if anyone can help me with creating a chart that will show hours averaged over the duration of a start and end date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the basics of the master calendar and have created this. I've also been able to calculate the business days/hours between the start date and end date. My problem is that I can't figure out how to average the estimated hours across a span of months and get the months to show up on the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been reading though a lot of the community posts and perhaps IntervalMatch is what I need to use, but not sure how to get that to work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 678px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="text-align: left;" width="105"&gt;&lt;STRONG&gt;StartDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="99"&gt;&lt;STRONG&gt;EndDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="163"&gt;&lt;STRONG&gt;EstimatedHours&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="192"&gt;&lt;STRONG&gt;ProjectName&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="119"&gt;&lt;STRONG&gt;Staff&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20" style="text-align: left;"&gt;7/1/2015&lt;/TD&gt;&lt;TD align="right" class="xl63" style="text-align: left;"&gt;11/30/2015&lt;/TD&gt;&lt;TD align="right" style="text-align: left;"&gt;500&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Project A&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Bill&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20" style="text-align: left;"&gt;8/1/2015&lt;/TD&gt;&lt;TD align="right" class="xl63" style="text-align: left;"&gt;09/30/2015&lt;/TD&gt;&lt;TD align="right" style="text-align: left;"&gt;300&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Project B&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'd like my chart to look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="b3397c6abf7341dda53884fd4dd6f02d.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/93250_b3397c6abf7341dda53884fd4dd6f02d.png" style="height: 262px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Jul 2015 02:26:14 GMT</pubDate>
    <dc:creator>drminaker</dc:creator>
    <dc:date>2015-07-18T02:26:14Z</dc:date>
    <item>
      <title>How to average hours between a start and end date?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900580#M12505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if anyone can help me with creating a chart that will show hours averaged over the duration of a start and end date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the basics of the master calendar and have created this. I've also been able to calculate the business days/hours between the start date and end date. My problem is that I can't figure out how to average the estimated hours across a span of months and get the months to show up on the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been reading though a lot of the community posts and perhaps IntervalMatch is what I need to use, but not sure how to get that to work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 678px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="text-align: left;" width="105"&gt;&lt;STRONG&gt;StartDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="99"&gt;&lt;STRONG&gt;EndDate&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="163"&gt;&lt;STRONG&gt;EstimatedHours&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="192"&gt;&lt;STRONG&gt;ProjectName&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="text-align: left;" width="119"&gt;&lt;STRONG&gt;Staff&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20" style="text-align: left;"&gt;7/1/2015&lt;/TD&gt;&lt;TD align="right" class="xl63" style="text-align: left;"&gt;11/30/2015&lt;/TD&gt;&lt;TD align="right" style="text-align: left;"&gt;500&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Project A&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Bill&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20" style="text-align: left;"&gt;8/1/2015&lt;/TD&gt;&lt;TD align="right" class="xl63" style="text-align: left;"&gt;09/30/2015&lt;/TD&gt;&lt;TD align="right" style="text-align: left;"&gt;300&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Project B&lt;/TD&gt;&lt;TD style="text-align: left;"&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'd like my chart to look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="b3397c6abf7341dda53884fd4dd6f02d.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/93250_b3397c6abf7341dda53884fd4dd6f02d.png" style="height: 262px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2015 02:26:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900580#M12505</guid>
      <dc:creator>drminaker</dc:creator>
      <dc:date>2015-07-18T02:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to average hours between a start and end date?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900581#M12506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;STRONG&gt;EstimatedHours&lt;/STRONG&gt;) / count(distinct Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have connected your &lt;STRONG&gt;StartDate&lt;/STRONG&gt; and &lt;STRONG&gt;EndDate&lt;/STRONG&gt; with the master calendar: &lt;A href="https://community.qlik.com/qlik-blogpost/3037"&gt;IntervalMatch&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2015 05:21:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900581#M12506</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-07-18T05:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to average hours between a start and end date?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900582#M12507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would consider breaking down the EstimatedHours to the smallest granularity needed using a WHILE loop, as demonstrated here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2940"&gt;Creating Reference Dates for Intervals&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14372126939435327 jive_text_macro" jivemacro_uid="_14372126939435327"&gt;
&lt;P&gt;SET DateFormat = 'M/D/YYYY';&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;INPUT:&lt;/P&gt;
&lt;P&gt;LOAD Recno() as ID, * INLINE [&lt;/P&gt;
&lt;P&gt;StartDate, EndDate, EstimatedHours, ProjectName, Staff&lt;/P&gt;
&lt;P&gt;7/1/2015, 11/30/2015, 500, Project A, Bill&lt;/P&gt;
&lt;P&gt;8/1/2015, 09/30/2015, 300, Project B, Bob&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ID_x_Dates:&lt;/P&gt;
&lt;P&gt;Load ID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EstimatedHours / (EndDate - StartDate + 1) as DailyEstimatedHour,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(StartDate + IterNo() -1 ) as ReferenceDate&lt;/P&gt;
&lt;P&gt;Resident INPUT&lt;/P&gt;
&lt;P&gt;While IterNo() &amp;lt;= EndDate - StartDate + 1 ;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I used a date as finest granularity, which you can easily aggregate to week / month / quarter using a master calendar connected to ReferenceDate. If you only need a Monthly view, you can also change the code to iterate over Months, not dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2015 09:46:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900582#M12507</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-07-18T09:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to average hours between a start and end date?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900583#M12508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for this. I applied it to my real data and it works great! As Marcus mentioned, I was sure the solution had something to do with intervals, but just wasn't sure how it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another question for you -- if I wanted this to span the minutes/hours only over work days where would be the best place to apply Networkdays function? The loadscript, master calendar, custom dimension?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 01:00:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900583#M12508</guid>
      <dc:creator>drminaker</dc:creator>
      <dc:date>2015-07-22T01:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to average hours between a start and end date?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900584#M12509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for pointing me to that link. I'm determined to become expert on how all this works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 01:00:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-average-hours-between-a-start-and-end-date/m-p/900584#M12509</guid>
      <dc:creator>drminaker</dc:creator>
      <dc:date>2015-07-22T01:00:45Z</dc:date>
    </item>
  </channel>
</rss>

