<?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: Hopefully quick question about calculated colours! in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938647#M323899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to say but I understand it right the first time. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try a Bg expression like: ='Red' &amp;amp; '()' it wouldn't work, so changing 'Red' by the value returned by IMP.Colour doesn't works either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To concatenate values in that way you must use $-expansion but this is calculated before the table, so it's not row by row and won't give you the desired result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround you can try to change your IMP.Colour to 3 fields to give the rgb code as said in my previous post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe wait for another user gives you the solution building a color function like Red() or Blue() for a dimension background using a field value. I don't know how.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Oct 2015 15:46:44 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2015-10-08T15:46:44Z</dc:date>
    <item>
      <title>Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938644#M323896</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 change colours in a pie chart based upon the field in question - this actually contains the colour. I'd like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So there are 5 possible colours in my data - black, blue, green, red and yellow. All of these can be called directly using Black(), Blue() etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried to calculate the colours using this as my expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IMP.Colour &amp;amp; '()'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However nothing happens - the colours do not change. This doesn't work for changing the background of table cells either. Is it possible to do? I'd rather avoid If statements if possible seeing as the colours are so standard.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:00:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938644#M323896</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-08T15:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938645#M323897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jo, I made something similar but using RGB codes:&lt;/P&gt;&lt;P&gt;3 fields: RedBg, GreenBg, BlueBg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And dimension Background color expression as:&lt;/P&gt;&lt;P&gt;=RGB(RedBg, GreenBg, BlueBg)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:20:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938645#M323897</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-10-08T15:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938646#M323898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Ruben,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, I think I may not have been clear. There is a field called IMP.Colour in my dataset that actually contains the colour required as text - the possible values for the field are: Black, Red, Green, Yellow, Blue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought that I could just concatenate this with () within the calculated colour expression so that the field value would be changed to Black(), Red(), Green() etc. I don't understand why it is not working however. When you just enter =Black() as the calculated colour&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;, the colour changes to black.&amp;nbsp; So &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;why doesn't&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =IMP.Colour &amp;amp; '()'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change the colour to black if IMP.Colour = 'Black'?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can achieve the same result using an IF statement but my other idea seemed so much cleaner and probably better for performance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The equivalent IF statement would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Iff(IMP.Colour = 'Black', Black(), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(IMP.Colour = 'Red', Red(), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(IMP.Colour = 'Yellow', Yellow(), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(IMP.Colour = 'Green', Green(), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Blue()))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:36:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938646#M323898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-08T15:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938647#M323899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to say but I understand it right the first time. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try a Bg expression like: ='Red' &amp;amp; '()' it wouldn't work, so changing 'Red' by the value returned by IMP.Colour doesn't works either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To concatenate values in that way you must use $-expansion but this is calculated before the table, so it's not row by row and won't give you the desired result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround you can try to change your IMP.Colour to 3 fields to give the rgb code as said in my previous post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe wait for another user gives you the solution building a color function like Red() or Blue() for a dimension background using a field value. I don't know how.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:46:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938647#M323899</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-10-08T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938648#M323900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don0t find another way, to make easy my workaround you can map the string color to the codes:&lt;/P&gt;&lt;P&gt;MAP_Colors:&lt;/P&gt;&lt;P&gt;Mapping LOAD * Inline [&lt;/P&gt;&lt;P&gt;Name, code&lt;/P&gt;&lt;P&gt;Black, 0;0;0&lt;/P&gt;&lt;P&gt;Red, 255;0;0&lt;/P&gt;&lt;P&gt;Yellow, 255;255;0&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD ... // [Your fields]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMP.Colour&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subfield(ApplyMap('MAP_Colors', IMP.Colour), ';', 1) as IMP.ColourRed,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subfield(ApplyMap('MAP_Colors', IMP.Colour), ';', 2) as IMP.ColourGreen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Subfield(ApplyMap('MAP_Colors', IMP.Colour), ';', 3) as IMP.ColourBlue&lt;/P&gt;&lt;P&gt;FROM ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Then you can use this bg expression:&lt;/P&gt;&lt;P&gt;RGB(IMP.ColourRed,IMP.ColourGreen,IMP.ColourBlue)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:55:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938648#M323900</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-10-08T15:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938649#M323901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jo,&lt;/P&gt;&lt;P&gt;The expression =IMP.Colour &amp;amp; '()' does not work because qlkiview interprets this as a string and not as a function.&lt;/P&gt;&lt;P&gt;Instead of using IF statements, you could load a mapping table where you have something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD * Inline&lt;BR /&gt; [IMP.Colour, ColourFunction&lt;BR /&gt; Red, Red()&lt;BR /&gt; Black, Black()&lt;BR /&gt; White, White()&lt;BR /&gt; ]; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then use the following expression for the calculated colour:&lt;/P&gt;&lt;P&gt;=$(=ColourFunction)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 15:56:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938649#M323901</guid>
      <dc:creator>sergiorey</dc:creator>
      <dc:date>2015-10-08T15:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938650#M323902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dont think you can do this directly, but the easiest way to do this is to create a variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set vColorBG = Pick(match($1 ,'Black','Red', 'Yellow', 'Green', 'Blue'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Black(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Red(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yellow(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Green(),&lt;/P&gt;&lt;P&gt;&amp;nbsp; Blue()&lt;/P&gt;&lt;P&gt;&amp;nbsp; );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use $(vColorBG(Color)) as the backgroun color expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:11:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938650#M323902</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2015-10-08T16:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938651#M323903</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;one solution could be a color expression like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14443349948293002 jive_text_macro" jivemacro_uid="_14443349948293002"&gt;
&lt;P&gt;=Pick(Match(IMP.Color,$(=Chr(39)&amp;amp;Concat({1} DISTINCT IMP.Color,Chr(39)&amp;amp;','&amp;amp;Chr(39))&amp;amp;Chr(39))),$(=Concat({1} DISTINCT IMP.Color,'(),')&amp;amp;'()'))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_186018_Pic3.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101483_QlikCommunity_Thread_186018_Pic3.JPG" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_186018_Pic1.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/101484_QlikCommunity_Thread_186018_Pic1.JPG" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="QlikCommunity_Thread_186018_Pic2.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/101485_QlikCommunity_Thread_186018_Pic2.JPG" style="max-width: 620px; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2015 20:10:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938651#M323903</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2015-10-08T20:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully quick question about calculated colours!</title>
      <link>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938652#M323904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for the fantastic help! There were several different options but I went with this as it was the fastest to implement and only involved a quick tweak in the top level document...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calculated background colour for the expression: &lt;/P&gt;&lt;P&gt;=Pick(Match(IMP.Colour,$(=Chr(39)&amp;amp;Concat({1} DISTINCT IMP.Colour,Chr(39)&amp;amp;','&amp;amp;Chr(39))&amp;amp;Chr(39))),$(=Concat({1} DISTINCT IMP.Colour,'(),')&amp;amp;'()'))&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set the colours manually and checked 'Persistent Colors'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort by expression:&lt;/P&gt;&lt;P&gt;=if(IMP.Colour='Black',1,if(IMP.Colour='Red',2,if(IMP.Colour='Yellow',3,if(IMP.Colour='Green',4,5))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2015 10:22:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Hopefully-quick-question-about-calculated-colours/m-p/938652#M323904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-16T10:22:12Z</dc:date>
    </item>
  </channel>
</rss>

