<?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: Line chart showing Daily and Monthly average in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82675#M5484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(Aggr(&lt;SPAN style="color: #ff0000;"&gt;NODISTINCT&lt;/SPAN&gt; Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date])), [Gate_Access.autoCalendar.YearMonth]))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(&lt;SPAN style="color: #ff0000;"&gt;TOTAL &amp;lt;[Gate_Access.autoCalendar.YearMonth]&amp;gt;&lt;/SPAN&gt; Aggr(Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date])), [Gate_Access.autoCalendar.YearMonth]&lt;SPAN style="color: #ff0000;"&gt;, [Gate_Access.autoCalendar.Date]&lt;/SPAN&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 10 Mar 2018 14:36:28 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-03-10T14:36:28Z</dc:date>
    <item>
      <title>Line chart showing Daily and Monthly average</title>
      <link>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82674#M5483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is probably trivial and I bet lots of users have faced this before, but I can't seem to find a relevant discussion on this.&lt;/P&gt;&lt;P&gt;I want to be able to show in a line chart both the daily values and a stepped line showing the monthly (or weekely) average.&lt;/P&gt;&lt;P&gt;The current application analyzes the times spent by employees in the office.&lt;/P&gt;&lt;P&gt;The data is based on gates access timestamps, and the transactions table looks like this:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;BadgeID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Gate_Access&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;ID1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day1/Time1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day1/Time2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day1/Time3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day1/Time4 etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;ID1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day2/Time1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Day2/Time2 etc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;ID2 etc&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So for each ID, for each day, I have multiple gate access times.&lt;/P&gt;&lt;P&gt;With a reasonable approximation I will consider the time spent by each employee as the Max-Min for each day. I will then need to aggregate this further up at Month level or Department Level based on the Median &lt;/P&gt;&lt;P&gt;I calculated this as follows:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date]))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Works perfectly and is correctly aggregated at all needed levels&lt;/P&gt;&lt;P&gt;I then want to plot this as a daily line chart, but I also want to show the Monthly average (as a stepped line).&lt;/P&gt;&lt;P&gt;I was able to calculate the monthly average as follows:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(aggr(Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date])), [Gate_Access.autoCalendar.YearMonth]))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this only calculates one value, against the start of the Month, and looks like this on the line chart&amp;nbsp; - &lt;STRONG&gt;the red dot&lt;/STRONG&gt; (the yellow line is a Window average):&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screenshot 2018-03-10 09.12.34.png" class="jive-image image-1" src="/legacyfs/online/195946_Screenshot 2018-03-10 09.12.34.png" style="height: 265px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;How can I write the expression so it uses the day granularity , but using the monthly average?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Mar 2018 07:31:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82674#M5483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-10T07:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Line chart showing Daily and Monthly average</title>
      <link>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82675#M5484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(Aggr(&lt;SPAN style="color: #ff0000;"&gt;NODISTINCT&lt;/SPAN&gt; Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date])), [Gate_Access.autoCalendar.YearMonth]))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avg(&lt;SPAN style="color: #ff0000;"&gt;TOTAL &amp;lt;[Gate_Access.autoCalendar.YearMonth]&amp;gt;&lt;/SPAN&gt; Aggr(Median( aggr(max(Gate_Access)-min(Gate_Access), [BadgeID-Badge ID], [Gate_Access.autoCalendar.Date])), [Gate_Access.autoCalendar.YearMonth]&lt;SPAN style="color: #ff0000;"&gt;, [Gate_Access.autoCalendar.Date]&lt;/SPAN&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Mar 2018 14:36:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82675#M5484</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-03-10T14:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Line chart showing Daily and Monthly average</title>
      <link>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82676#M5485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second one doesn't work, it calculates a straight line across the whole date dimension (average across all dates)&lt;/P&gt;&lt;P&gt;The first one does the trick perfectly!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screenshot 2018-03-10 20.20.36.png" class="jive-image image-1" src="/legacyfs/online/195971_Screenshot 2018-03-10 20.20.36.png" style="height: 264px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Mar 2018 18:22:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Line-chart-showing-Daily-and-Monthly-average/m-p/82676#M5485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-10T18:22:28Z</dc:date>
    </item>
  </channel>
</rss>

