<?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: changing line graph color based on Trendline in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/changing-line-graph-color-based-on-Trendline/m-p/66079#M788117</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all you need to calculate the slope of the trend line; you'll need to recalculate it as, depending on its value, you'll then be able to change the colour of the line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a linear regression function, the slope is calculated using the &lt;SPAN style="font-size: 13.3333px;"&gt;LINEST_M function. See example below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=LINEST_M(total aggr(Sum (Sales),Month), Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of important points:&lt;/P&gt;&lt;P&gt;- replace Sales and Month with your dimensions&lt;/P&gt;&lt;P&gt;- make sure you use the total qualifier as you will need to know the overall slope of the curve for every value of your month dimension&lt;/P&gt;&lt;P&gt;- I'm making the assumption that your data is already ordered by month; if not, in the aggregation you'll need to sort the data (using StructuredParameter syntax)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To change the colour of the line, edit the background colour of the expression with something like:&lt;/P&gt;&lt;P&gt;=if (&lt;SPAN style="font-size: 13.3333px;"&gt;LINEST_M(total aggr(Sum (Sales),Month), Month) &amp;gt;=0, green(), red())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see example attached; as you select between the two products the colour of the line will change according to the slope of the trendline&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lorenzo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Feb 2018 17:11:50 GMT</pubDate>
    <dc:creator>lorenzoconforti</dc:creator>
    <dc:date>2018-02-07T17:11:50Z</dc:date>
    <item>
      <title>changing line graph color based on Trendline</title>
      <link>https://community.qlik.com/t5/QlikView/changing-line-graph-color-based-on-Trendline/m-p/66078#M788116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I have a simple line graph which spans over a period of time.&lt;/P&gt;&lt;P&gt;I have also a 'Linear Trendline' as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is to change the original graph line color (currently in blue), based on the Trendline.&lt;/P&gt;&lt;P&gt;So if the Trend is upwards, it should show 'red'. If the Trend is downwards, it should show 'green'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please&amp;nbsp; help here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Untitled.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/192725_Untitled.png" style="height: 80px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/changing-line-graph-color-based-on-Trendline/m-p/66078#M788116</guid>
      <dc:creator>sayadutt</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: changing line graph color based on Trendline</title>
      <link>https://community.qlik.com/t5/QlikView/changing-line-graph-color-based-on-Trendline/m-p/66079#M788117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all you need to calculate the slope of the trend line; you'll need to recalculate it as, depending on its value, you'll then be able to change the colour of the line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a linear regression function, the slope is calculated using the &lt;SPAN style="font-size: 13.3333px;"&gt;LINEST_M function. See example below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=LINEST_M(total aggr(Sum (Sales),Month), Month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of important points:&lt;/P&gt;&lt;P&gt;- replace Sales and Month with your dimensions&lt;/P&gt;&lt;P&gt;- make sure you use the total qualifier as you will need to know the overall slope of the curve for every value of your month dimension&lt;/P&gt;&lt;P&gt;- I'm making the assumption that your data is already ordered by month; if not, in the aggregation you'll need to sort the data (using StructuredParameter syntax)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To change the colour of the line, edit the background colour of the expression with something like:&lt;/P&gt;&lt;P&gt;=if (&lt;SPAN style="font-size: 13.3333px;"&gt;LINEST_M(total aggr(Sum (Sales),Month), Month) &amp;gt;=0, green(), red())&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see example attached; as you select between the two products the colour of the line will change according to the slope of the trendline&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lorenzo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Feb 2018 17:11:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/changing-line-graph-color-based-on-Trendline/m-p/66079#M788117</guid>
      <dc:creator>lorenzoconforti</dc:creator>
      <dc:date>2018-02-07T17:11:50Z</dc:date>
    </item>
  </channel>
</rss>

