<?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 Regression lines and aggregation in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Regression-lines-and-aggregation/m-p/1771993#M59758</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I have created a regression line for a combo chart based on daily data that works fine.&amp;nbsp; The formula is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_m(total aggr(if(Sum([Page Visits]),Sum([Page Visits])),[Action Date]),[Action Date])*
	only([Action Date])+linest_b(total aggr(if(Sum([Page Visits]),Sum([Page Visits])),[Action Date]),[Action Date])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I also need to be able to show the regression lines for average daily values by week and by month.&amp;nbsp; The formula for the weekly data is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try to use this with the linest_m and linest_b functions, I get some strange results that don't appear to be on the same scale as I was expecting:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_m(Total Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)]),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_b(Total Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)]),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Linear Regression issue 2 week.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46450i4B49E3CADDE9F2EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Linear Regression issue 2 week.PNG" alt="Linear Regression issue 2 week.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the screen shot above, the average values range from 179 to 454, and when I export the data to Excel and create a scatter chart with a linear trendline, I see that&amp;nbsp; the slope value is -61.748 and the y-intercept is 431.59.&amp;nbsp; These are the values I am expecting to get from the linest_m and linest_b functions in Qlik Sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Linear Regression issue 3 week in Excel.PNG" style="width: 959px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46452i4B94DB26172C5D53/image-size/large?v=v2&amp;amp;px=999" role="button" title="Linear Regression issue 3 week in Excel.PNG" alt="Linear Regression issue 3 week in Excel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 17:38:49 GMT</pubDate>
    <dc:creator>rbartley</dc:creator>
    <dc:date>2024-11-16T17:38:49Z</dc:date>
    <item>
      <title>Regression lines and aggregation</title>
      <link>https://community.qlik.com/t5/App-Development/Regression-lines-and-aggregation/m-p/1771993#M59758</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I have created a regression line for a combo chart based on daily data that works fine.&amp;nbsp; The formula is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_m(total aggr(if(Sum([Page Visits]),Sum([Page Visits])),[Action Date]),[Action Date])*
	only([Action Date])+linest_b(total aggr(if(Sum([Page Visits]),Sum([Page Visits])),[Action Date]),[Action Date])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I also need to be able to show the regression lines for average daily values by week and by month.&amp;nbsp; The formula for the weekly data is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try to use this with the linest_m and linest_b functions, I get some strange results that don't appear to be on the same scale as I was expecting:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_m(Total Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)]),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;linest_b(Total Aggr(Avg(Aggr(Sum(if([Page Visits],[Page Visits])), [Action_Date_Key])),[Action Week (Numeric)]),[Action Week (Numeric)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Linear Regression issue 2 week.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46450i4B49E3CADDE9F2EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Linear Regression issue 2 week.PNG" alt="Linear Regression issue 2 week.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the screen shot above, the average values range from 179 to 454, and when I export the data to Excel and create a scatter chart with a linear trendline, I see that&amp;nbsp; the slope value is -61.748 and the y-intercept is 431.59.&amp;nbsp; These are the values I am expecting to get from the linest_m and linest_b functions in Qlik Sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Linear Regression issue 3 week in Excel.PNG" style="width: 959px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/46452i4B94DB26172C5D53/image-size/large?v=v2&amp;amp;px=999" role="button" title="Linear Regression issue 3 week in Excel.PNG" alt="Linear Regression issue 3 week in Excel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:38:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Regression-lines-and-aggregation/m-p/1771993#M59758</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2024-11-16T17:38:49Z</dc:date>
    </item>
  </channel>
</rss>

