<?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 Set Analysis on Expression on Bar Chart in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313302#M1183942</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 see an extra closing bracket at the end of the statemement. Try removing that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some more general suggestions, more about optimisation than fixing the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...I would concatenate all the treatment codes into a variable in the load script and use that variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&amp;lt;[Treatment Function Code]={$(vTreatmentCodes)}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and I would combine some the the cost elements into a combined cost field during load (you can leave the individual ones there if you need them elsewhere in your model)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and finally since sum(a) + sum(b) = sum(a + b), I would use the latter form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM([COST_NURSING] +&amp;nbsp; [COST_CONSULTANTS] + [COST_OTHERCLINICALPAY] + ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2011 19:24:41 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2011-10-05T19:24:41Z</dc:date>
    <item>
      <title>Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313299#M1183938</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;We want to produce a bar chart of contribution percentage by treatment function code however due to the way some of our data is processed with get a lot of dummy treatment function codes that we don't want to chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've done a bar chart with the dimension as Treatment Function Code and the expression I want to use is as follows (which works if I have a single field - say revenue- but I need the calculated "Contribution percentage" as per the latter part of the expression. Any ideas how I can get this to work please as it just says Error in Expression.&lt;/P&gt;&lt;P&gt;﻿&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;=SUM({$&amp;lt;[Treatment Function Code]={&lt;/P&gt;&lt;P&gt;"100-GENERAL SURGERY",&lt;/P&gt;&lt;P&gt;"101-UROLOGY",&lt;/P&gt;&lt;P&gt;"110-TRAUMA &amp;amp; ORTHOPAEDICS",&lt;/P&gt;&lt;P&gt;"120-ENT",&lt;/P&gt;&lt;P&gt;"130-OPHTHALMOLOGY",&lt;/P&gt;&lt;P&gt;"140-ORAL SURGERY",&lt;/P&gt;&lt;P&gt;"143-ORTHODONTICS",&lt;/P&gt;&lt;P&gt;"160-PLASTIC SURGERY",&lt;/P&gt;&lt;P&gt;"170-CARDIOTHORACIC SURGERY",&lt;/P&gt;&lt;P&gt;"180-ACCIDENT &amp;amp; EMERGENCY",&lt;/P&gt;&lt;P&gt;"191-PAIN MANAGEMENT",&lt;/P&gt;&lt;P&gt;"300-GENERAL MEDICINE",&lt;/P&gt;&lt;P&gt;"301-GASTROENTEROLOGY",&lt;/P&gt;&lt;P&gt;"302-ENDOCRINOLOGY",&lt;/P&gt;&lt;P&gt;"303-HAEMATOLOGY (CLINICAL)",&lt;/P&gt;&lt;P&gt;"320-CARDIOLOGY",&lt;/P&gt;&lt;P&gt;"330-DERMATOLOGY",&lt;/P&gt;&lt;P&gt;"340-THORACIC MEDICINE",&lt;/P&gt;&lt;P&gt;"361-NEPHROLOGY",&lt;/P&gt;&lt;P&gt;"370-MEDICAL ONCOLOGY",&lt;/P&gt;&lt;P&gt;"400-NEUROLOGY",&lt;/P&gt;&lt;P&gt;"410-RHEUMATOLOGY",&lt;/P&gt;&lt;P&gt;"420-PAEDIATRICS",&lt;/P&gt;&lt;P&gt;"430-CARE OF THE ELDERLY",&lt;/P&gt;&lt;P&gt;"430S-STROKE SERVICES",&lt;/P&gt;&lt;P&gt;"501-OBSTETRICS FOR PATIENTS USING A HOSPITAL BED OR",&lt;/P&gt;&lt;P&gt;"502-GYNAECOLOGY",&lt;/P&gt;&lt;P&gt;"560-MIDWIFE EPISODE",&lt;/P&gt;&lt;P&gt;"650-PHYSIOTHERAPY",&lt;/P&gt;&lt;P&gt;"654-DIETETICS",&lt;/P&gt;&lt;P&gt;"822-CHEMICAL PATHOLOGY",&lt;/P&gt;&lt;P&gt;"960-NURSE LED"&lt;/P&gt;&lt;P&gt;}&amp;gt;}NUM((SUM([revenue]) - (SUM([COST_NURSING])+SUM([COST_CONSULTANTS])+SUM([COST_OTHERCLINICALPAY])+SUM([COST_NONCLINICALPAY])&lt;/P&gt;&lt;P&gt;+SUM([COST_DRUGS])+SUM([COST_CLINICALSUPPLIES])+SUM([COST_OTHERDIRECTCOSTS])+SUM([COST_ALLIEDHEALTHPROFESSIONALS])+SUM([COST_RADIOLOGY])+SUM([COST_PATHOLOGY])&lt;/P&gt;&lt;P&gt;+SUM([COST_THEATRECOSTS])+SUM([COST_OTHERSERVICES])+SUM([COST_PROSTHETICS])+SUM([COST_HOTELSERVICES])+SUM([COST_PHARMACY]))) / SUM([revenue]),'##.##%')))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Any help appreciated. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 08:54:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313299#M1183938</guid>
      <dc:creator />
      <dc:date>2011-10-05T08:54:30Z</dc:date>
    </item>
    <item>
      <title>Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313300#M1183939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=NUM((SUM({$&amp;lt;[Treatment Function Code]={&lt;/P&gt;&lt;P&gt;"100-GENERAL SURGERY",&lt;/P&gt;&lt;P&gt;"101-UROLOGY",&lt;/P&gt;&lt;P&gt;"110-TRAUMA &amp;amp; ORTHOPAEDICS",&lt;/P&gt;&lt;P&gt;"120-ENT",&lt;/P&gt;&lt;P&gt;"130-OPHTHALMOLOGY",&lt;/P&gt;&lt;P&gt;"140-ORAL SURGERY",&lt;/P&gt;&lt;P&gt;"143-ORTHODONTICS",&lt;/P&gt;&lt;P&gt;"160-PLASTIC SURGERY",&lt;/P&gt;&lt;P&gt;"170-CARDIOTHORACIC SURGERY",&lt;/P&gt;&lt;P&gt;"180-ACCIDENT &amp;amp; EMERGENCY",&lt;/P&gt;&lt;P&gt;"191-PAIN MANAGEMENT",&lt;/P&gt;&lt;P&gt;"300-GENERAL MEDICINE",&lt;/P&gt;&lt;P&gt;"301-GASTROENTEROLOGY",&lt;/P&gt;&lt;P&gt;"302-ENDOCRINOLOGY",&lt;/P&gt;&lt;P&gt;"303-HAEMATOLOGY (CLINICAL)",&lt;/P&gt;&lt;P&gt;"320-CARDIOLOGY",&lt;/P&gt;&lt;P&gt;"330-DERMATOLOGY",&lt;/P&gt;&lt;P&gt;"340-THORACIC MEDICINE",&lt;/P&gt;&lt;P&gt;"361-NEPHROLOGY",&lt;/P&gt;&lt;P&gt;"370-MEDICAL ONCOLOGY",&lt;/P&gt;&lt;P&gt;"400-NEUROLOGY",&lt;/P&gt;&lt;P&gt;"410-RHEUMATOLOGY",&lt;/P&gt;&lt;P&gt;"420-PAEDIATRICS",&lt;/P&gt;&lt;P&gt;"430-CARE OF THE ELDERLY",&lt;/P&gt;&lt;P&gt;"430S-STROKE SERVICES",&lt;/P&gt;&lt;P&gt;"501-OBSTETRICS FOR PATIENTS USING A HOSPITAL BED OR",&lt;/P&gt;&lt;P&gt;"502-GYNAECOLOGY",&lt;/P&gt;&lt;P&gt;"560-MIDWIFE EPISODE",&lt;/P&gt;&lt;P&gt;"650-PHYSIOTHERAPY",&lt;/P&gt;&lt;P&gt;"654-DIETETICS",&lt;/P&gt;&lt;P&gt;"822-CHEMICAL PATHOLOGY",&lt;/P&gt;&lt;P&gt;"960-NURSE LED"&lt;/P&gt;&lt;P&gt;}&amp;gt;}[revenue]) - &lt;/P&gt;&lt;P&gt;(SUM([COST_NURSING])+SUM([COST_CONSULTANTS])+SUM([COST_OTHERCLINICALPAY])+SUM([COST_NONCLINICALPAY])&lt;/P&gt;&lt;P&gt;+SUM([COST_DRUGS])+SUM([COST_CLINICALSUPPLIES])+SUM([COST_OTHERDIRECTCOSTS])+SUM([COST_ALLIEDHEALTHPROFESSIONALS])+SUM([COST_RADIOLOGY])+SUM([COST_PATHOLOGY])&lt;/P&gt;&lt;P&gt;+SUM([COST_THEATRECOSTS])+SUM([COST_OTHERSERVICES])+SUM([COST_PROSTHETICS])+SUM([COST_HOTELSERVICES])+SUM([COST_PHARMACY]))) / SUM([revenue]),'##.##%')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 18:57:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313300#M1183939</guid>
      <dc:creator />
      <dc:date>2011-10-05T18:57:34Z</dc:date>
    </item>
    <item>
      <title>Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313301#M1183941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try changing the " to a single quote '&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 19:03:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313301#M1183941</guid>
      <dc:creator />
      <dc:date>2011-10-05T19:03:31Z</dc:date>
    </item>
    <item>
      <title>Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313302#M1183942</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 see an extra closing bracket at the end of the statemement. Try removing that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some more general suggestions, more about optimisation than fixing the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...I would concatenate all the treatment codes into a variable in the load script and use that variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&amp;lt;[Treatment Function Code]={$(vTreatmentCodes)}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and I would combine some the the cost elements into a combined cost field during load (you can leave the individual ones there if you need them elsewhere in your model)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... and finally since sum(a) + sum(b) = sum(a + b), I would use the latter form:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM([COST_NURSING] +&amp;nbsp; [COST_CONSULTANTS] + [COST_OTHERCLINICALPAY] + ...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 19:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313302#M1183942</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2011-10-05T19:24:41Z</dc:date>
    </item>
    <item>
      <title>Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313303#M1183943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Zack, the error message was removed with your expression but the resulting chart returned all treatment function codes not just the ones identifed in the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan, that sounds like a very good idea! What is the basic script I would need to use to create a variable pleases?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 08:44:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313303#M1183943</guid>
      <dc:creator />
      <dc:date>2011-10-06T08:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis on Expression on Bar Chart</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313304#M1183944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lee&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot paste into the forum from where I am entering this post, so I have appended a sample script in a qvs file. In case you are confused, chr(39) is the code for a single quote character, as the treatment codes need to be wrapped in single or double quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 10:38:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-on-Expression-on-Bar-Chart/m-p/313304#M1183944</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2011-10-06T10:38:42Z</dc:date>
    </item>
  </channel>
</rss>

