<?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 Color bar chart by 12-month trend in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Color-bar-chart-by-12-month-trend/m-p/112933#M7793</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;I'm using Linest_M and a date flag to calculate a 12-month trend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15365941864999328" jivemacro_uid="_15365941864999328" modifiedtitle="true"&gt;
&lt;P&gt;Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm displaying this as a KPI, but also have a vertical bar chart with showing result by month over the past 5 years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15365943437348108 jive_text_macro" jivemacro_uid="_15365943437348108" modifiedtitle="true"&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},State-={$(=Only(pExcl_State))},Company={$(=Only(pComp_Num))}&lt;SPAN style="font-size: 9pt;"&gt;&amp;gt;}[Sales_#])&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=Only(pSeg_Denom))},State-={$(=Only(pExcl_State))},Company={$(=vComp_Denom)}&lt;SPAN style="font-size: 9pt;"&gt;&amp;gt;}[Sales_#])&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two separate date fields used:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Data_Date - the month the data was generated; &lt;STRONG&gt;&lt;EM&gt;used as the date dimension for the line chart&lt;/EM&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Report_Month - used to filter KPIs for the month the user wants to view. This is created in the load script as =MonthName([%AsOfKey])&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created an expression to change color based on the current trend. &lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15365949855787775" jivemacro_uid="_15365949855787775" modifiedtitle="true"&gt;
&lt;P&gt;If(Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&amp;gt;0.03,'#e7aa98',if(&lt;/P&gt;
&lt;P&gt;Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&amp;gt;0.0025,'#e9e9e9','#89b1c0'))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine when I test it using a text box, but doesn't work when I try using it for the chart. How do I fix this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any ideas or suggestions you can provide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Sep 2018 15:59:35 GMT</pubDate>
    <dc:creator>phuelish</dc:creator>
    <dc:date>2018-09-10T15:59:35Z</dc:date>
    <item>
      <title>Color bar chart by 12-month trend</title>
      <link>https://community.qlik.com/t5/App-Development/Color-bar-chart-by-12-month-trend/m-p/112933#M7793</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;I'm using Linest_M and a date flag to calculate a 12-month trend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15365941864999328" jivemacro_uid="_15365941864999328" modifiedtitle="true"&gt;
&lt;P&gt;Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm displaying this as a KPI, but also have a vertical bar chart with showing result by month over the past 5 years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15365943437348108 jive_text_macro" jivemacro_uid="_15365943437348108" modifiedtitle="true"&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},State-={$(=Only(pExcl_State))},Company={$(=Only(pComp_Num))}&lt;SPAN style="font-size: 9pt;"&gt;&amp;gt;}[Sales_#])&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=Only(pSeg_Denom))},State-={$(=Only(pExcl_State))},Company={$(=vComp_Denom)}&lt;SPAN style="font-size: 9pt;"&gt;&amp;gt;}[Sales_#])&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two separate date fields used:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Data_Date - the month the data was generated; &lt;STRONG&gt;&lt;EM&gt;used as the date dimension for the line chart&lt;/EM&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Report_Month - used to filter KPIs for the month the user wants to view. This is created in the load script as =MonthName([%AsOfKey])&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created an expression to change color based on the current trend. &lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15365949855787775" jivemacro_uid="_15365949855787775" modifiedtitle="true"&gt;
&lt;P&gt;If(Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&amp;gt;0.03,'#e7aa98',if(&lt;/P&gt;
&lt;P&gt;Linest_m({&amp;lt;[Rolling 13]={1}&amp;gt;} aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;Segment={$(=Only(pSeg_Num))},Company={$(=Only(pComp_Num))},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;/Sum({&amp;lt;Segment={$(=only(pSeg_Denom))},Company={$(=vComp_Denom)},State-={$(=Only(pExcl_State))}&amp;gt;} [Sales_#])&lt;/P&gt;
&lt;P&gt;,[%AsOfKey]),[%AsOfKey])*365&amp;gt;0.0025,'#e9e9e9','#89b1c0'))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works fine when I test it using a text box, but doesn't work when I try using it for the chart. How do I fix this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any ideas or suggestions you can provide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2018 15:59:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Color-bar-chart-by-12-month-trend/m-p/112933#M7793</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2018-09-10T15:59:35Z</dc:date>
    </item>
  </channel>
</rss>

