<?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 Using maximum deviation to set color range in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-maximum-deviation-to-set-color-range/m-p/112090#M7707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to dynamically set the color range of a map so that the middle value of the gradient is equal to the average for all observations. The color by equation feature only allows me to set the top and the bottom of the range, so I'm doing this as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Top of Color Range: &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379841299529517 jive_text_macro" jivemacro_uid="_15379841299529517"&gt;
&lt;P&gt;measure + RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(measure,dimension)) - measure,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; measure - Min(aggr(measure,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bottom of Color Range: &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379841095361852 jive_text_macro" jivemacro_uid="_15379841095361852"&gt;
&lt;P&gt;measure - RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(measure,dimension)) - measure,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; measure - Min(aggr(measure,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a function within Qlik Sense that does the same thing? Because the measure contains a $-expansion in the set analysis, I can't simply define the measure as a variable. As an example, the measure calculation in one of the views is:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379840563582596 jive_text_macro" jivemacro_uid="_15379840563582596"&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales)&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the measure calculation appears 5 times in the color range limits equation, it's becoming overly complicated and with a lot of duplication.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15379841622388791" jivemacro_uid="_15379841622388791"&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt; + RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,dimension)) -&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;- Min(aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help or alternative means to the same end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Sep 2018 17:55:42 GMT</pubDate>
    <dc:creator>phuelish</dc:creator>
    <dc:date>2018-09-26T17:55:42Z</dc:date>
    <item>
      <title>Using maximum deviation to set color range</title>
      <link>https://community.qlik.com/t5/App-Development/Using-maximum-deviation-to-set-color-range/m-p/112090#M7707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to dynamically set the color range of a map so that the middle value of the gradient is equal to the average for all observations. The color by equation feature only allows me to set the top and the bottom of the range, so I'm doing this as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Top of Color Range: &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379841299529517 jive_text_macro" jivemacro_uid="_15379841299529517"&gt;
&lt;P&gt;measure + RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(measure,dimension)) - measure,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; measure - Min(aggr(measure,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bottom of Color Range: &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379841095361852 jive_text_macro" jivemacro_uid="_15379841095361852"&gt;
&lt;P&gt;measure - RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(measure,dimension)) - measure,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; measure - Min(aggr(measure,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a function within Qlik Sense that does the same thing? Because the measure contains a $-expansion in the set analysis, I can't simply define the measure as a variable. As an example, the measure calculation in one of the views is:&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15379840563582596 jive_text_macro" jivemacro_uid="_15379840563582596"&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales)&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the measure calculation appears 5 times in the color range limits equation, it's becoming overly complicated and with a lot of duplication.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15379841622388791" jivemacro_uid="_15379841622388791"&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt; + RangeMax(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,dimension)) -&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;- Min(aggr(&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;CTD_Key={$(=vCTD_Num)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key=($(=Only(pSeg_Num)))&amp;gt;}Sales)&lt;/P&gt;
&lt;P&gt;/Sum{&amp;lt;CTD_Key={$(=vCTD_Denom)},&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Segment_Key={$(=Only(pSeg_Denom))}&amp;gt;}Sales) &lt;/P&gt;
&lt;P&gt;,dimension)))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help or alternative means to the same end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2018 17:55:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-maximum-deviation-to-set-color-range/m-p/112090#M7707</guid>
      <dc:creator>phuelish</dc:creator>
      <dc:date>2018-09-26T17:55:42Z</dc:date>
    </item>
  </channel>
</rss>

